Cello How-To Guide Plugging-In Appfabric Caching
Total Page:16
File Type:pdf, Size:1020Kb
Cello How-To Guide Plugging-in AppFabric Caching How-To - Plugging-in App Fabric Caching Contents 1. Introduction ................................................................................................................................................ 3 1.1 Introduction to App Fabric Caching ................................................................................................... 3 1.2 Download Details ................................................................................................................................ 3 1.3 App Fabric Installation ....................................................................................................................... 4 1.4 Configuration .................................................................................................................................... 11 1.5 Advantages of Caching ...................................................................................................................... 13 1.6 Caching Best Practices ...................................................................................................................... 13 Contact Information ........................................................................................................................................... 14 2 How-To - Plugging-in App Fabric Caching 1. Introduction Caching is an effective concept that takes dynamic content and then creates a temporary reserve of that information. That temporary content is then served as static content until it expires. The types of caching mechanisms differentiate on what level they cache the data. Cello Recommends usage of App Fabric Cache for distributed Caching Mechanism. 1.1 Introduction to App Fabric Caching Windows Server AppFabric Caching features use a cluster of servers that communicate with each other to form a single, unified application cache system. As a distributed cache system, all cache operations are abstracted to a single point of reference, referred to as the cache cluster. In other words, your client applications can work with a single logical unit of cache in the cluster regardless of how many computers make up the cache cluster. AppFabric Caching is a distributed caching mechanism that allows multiple web applications to use the same cache, this is different to how most websites currently work, and even Orchard by default maintains its own cache within its separate website instances. With AppFabric, all website instances maintain and contribute to the same cache. By using cache, application performance can improve significantly by avoiding unnecessary calls to the data source. Distributed cache enables your application to match increasing demand with increasing throughput using a cache cluster that automatically manages the complexities of load balancing. When you use cache you can retrieve data by using keys or other identifiers, named "tags." App Fabric Cache supports optimistic and pessimistic concurrency models, high availability, and a variety of cache configurations. “App Fabric Cache” includes an ASP.NET session provider object that enables you to store ASP.NET session objects in the distributed cache without having to write to databases, which increases the performance and scalability of ASP.NET applications. 1.2 Download Details Download AppFabric from the following link based on caching deployment machine. Platform Setup Package Windows Vista and Windows Server WindowsServerAppFabricSetup_x64_6.0.exe 2008 x64 WindowsServerAppFabricSetup_x64_6.0.exe Windows 7 and Windows Server 2008 R2 3 How-To - Plugging-in App Fabric Caching x64 Windows Vista and Windows Server WindowsServerAppFabricSetup_x86_6.0.exe 2008 x86 Windows 7 x86 WindowsServerAppFabricSetup_x86_6.1.exe Download Link :http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=15848 Installation Steps: 1.3 App Fabric Installation Figure 1-1 - Accept License Terms Screen Accept the licence agreement and click “Next>”. 4 How-To - Plugging-in App Fabric Caching Figure 1-2– Customer Experience Screen Click “Next>”. Figure 1-3– Features Screen Select all options and click “Next>”. 5 How-To - Plugging-in App Fabric Caching Figure 1-4– Prerequisites Screen Click “Next>”. Figure 1-5– 6 How-To - Plugging-in App Fabric Caching Confirmation Screen Click “Install”. Figure 1-6– Results Screen Click “Finish”. Then AppFabric Configuration Wizard will be available to configure cluster. 7 How-To - Plugging-in App Fabric Caching Figure 1-7 – Before You Begin Screen Click “Next>”. Figure 1-8– Hosting Services Screen Click “Next>”. 8 How-To - Plugging-in App Fabric Caching Figure 1-9– Caching Services Check “Select Caching Service Configuration” and select “XML” in Caching Service Configuration provider”. Give the valid shared folder name in “File Share” path. Select the required Cluster Size from the dropdown (Small, Medium and Large). Figure 1-10– Cache Node Screen Click “Next>”. 9 How-To - Plugging-in App Fabric Caching Figure 1-11– Windows Server AppFabric Configuration Wizard Screen Select “Yes”. Figure 1-12– Configure Application Screen 10 How-To - Plugging-in App Fabric Caching Click “Finish”. Run Caching Administration Windows PowerShell. And Start the Cache cluster using the command “Start- CacheCluster”. Figure 1-13– Cache Cluster Screen 1.4 Configuration The following steps illustrate the process of configuring the AppFabric cache in the application. 1. Install the AppFabric cache as per the procedure described above. 2. Once the installation is complete, configure the application for the cache manager as per the steps given below, 3. The following are the various properties that are used in the above configuration Property Required Description Default Value RequestTimeout (seconds) No Used to set the Client time-out. Microsoft does 3(15) not recommend specifying a value less than 10000 (10 seconds). ChannelOpenTimeout No This attribute value can be set to 0 in order to 15(3) 11 How-To - Plugging-in App Fabric Caching (seconds) immediately handle any network problems. MaxConnectionsToServer No Used to set the Maximum number of 1 connections to the server. HostName Yes Specify the Host Name CachePort Yes Specify the Cache Port CacheHostName Yes Specify the Cache Host Name NamedCache Yes Specify the Cache Name LocalCache Yes Used to Enable the local cache. Possible values “True” and “False”. InvalidationPolicy Yes Possible values include NotificationBased and TimeoutBased. DefaultTimeOut(seconds) Yes Local cache time-out. ObjectCount No Maximum locally-cached object count 10,000 PollInterval No Specific cache notifications poll interval 300 (seconds) MaxQueueLength No Maximum queue length 10,000 SecurityMode No Possible values include Transport and None. Transport ProtectionLevel No Possible values include None, Sign, and EncryptAndSign EncryptAndSign. ChannelInitializationTimeout No Channel initialization timeout (seconds) ConnectionBufferSize No Connection buffer size MaxBufferPoolSize No Maximum buffer pool MaxBufferSize No Maximum buffer size MaxOutputDelay(seconds) No Maximum output delay 4. The methods to add and remove the items from the cache remain the same as that of a normal inproc caching mechanism. 12 How-To - Plugging-in App Fabric Caching 5. In case of opting to use the local cache, the set the LocalCache=”true” in the above configuration file. The properties that are applied to the local cache are ObjectCount, DefaultTimeOut and InvalidationPolicy. 1.5 Advantages of Caching The two main advantages of caching are: To reduce latency: Because the request is satisfied from the cache (which is closer to the client) instead of the origin server, it takes less time for it to get the representation and display it. This makes the Web seem more responsive. To reduce network traffic: Because representations are reused, it reduces the amount of bandwidth used by a client. This saves money if the client is paying for traffic, and keeps their bandwidth requirements lower and more manageable. 1.6 Caching Best Practices The following are some of the best practices in caching: Store the cached data in a variable: This is a design pattern that ensures that the cached object will not be destroyed (removed) while you are working with it. By setting a reference to the object first (a variable), you ensure that there is no change or disappearance at some random point in your code. When caching large amount of data, enable the cleanup (flush) mechanisms: Cache includes cleanup mechanisms for these reasons: To make it easy for the developer to specify the lifetime of cached data To limit the memory and resources consumed by cached data To ensure that the most-used items remain in the cache, while the least-used items are evicted from the cache. Cache data in the most useful format: The goal here is to cache your data in a format that is immediately useful when a page 13 How-To - Plugging-in App Fabric Caching Contact Information Any problem using this guide (or) using Cello Framework. Please feel free to contact us, we will be happy to assist you in getting started with Cello. Email: [email protected] Phone: +1(609)503-7163 Skype: techcello 14 .