AppFabric For Windows Server - Caching (formerly known as velocity)
In our project we came to the conclusion that caching would be a nice feature and that a distributed implementation would be best suited. We looked at the various offerings (NCache, MemCached, Custom implementation, App Fabric).
As AppFabric is the most compelling, I will elaborate on this one in detail;
Architecture
Requirements / Concerns
- Windows Enterprise Server
Important |
Windows Server AppFabric cache hosts should be dedicated to the caching service, which means that those servers are not also used as application, web, or database servers. It is possible to use non-dedicated cache servers in a cluster, but this scenario is not supported. Despite this policy, if you decide to use non-dedicated cache hosts, make sure to properly estimate and test the configuration for each cache host to allow enough memory and network resources for both the caching service and all other services on the machines. Also understand that spikes in processor and network utilization by other services will negatively impact the performance and stability of the cache cluster. For more information, see Windows Server AppFabric Caching Capacity Planning Guide. |
Important |
It is important that the cache cluster runs in a homogeneous environment of servers. It is not supported for cache hosts to have different physical specifications in memory, processor speed, and other capabilities. |
http://msdn.microsoft.com/en-us/windowsserver/ee695849 How to use it
//Each application has a similar GetCache method call DataCacheFactory myCacheFactory = new DataCacheFactory(); DataCache catalog = myCacheFactory.GetCache("catalog"); //One cache client saves an object to the catalog named "toy101" catalog.Put("toy101", new ToyObject("toy101", "Playschool")); //The same or different cache client retrieves the object ToyObject toy = (ToyObject)catalog.Get("toy101"); //The same or a different cache client removes the object catalog.Remove("toy101");Note: Required VS.Net References C:\Windows\System32\AppFabric\Microsoft.ApplicationServer.Caching.Core.dll C:\Windows\System32\AppFabric\Microsoft.ApplicationServer.Caching.Client.dll Installation Download http://www.microsoft.com/download/en/details.aspx?id=15848
- Windows Server 2008 x86 - WindowsServerAppFabricSetup_x86_6.0.exe
- Windows Vista x86 - WindowsServerAppFabricSetup_x86_6.0.exe
- Windows Server 2008 x64 - WindowsServerAppFabricSetup_x64_6.0.exe
- Windows Vista x64 - WindowsServerAppFabricSetup_x64_6.0.exe
- Windows 7 x86 - WindowsServerAppFabricSetup_x86_6.1.exe
- Windows Server 2008 R2 x64 - WindowsServerAppFabricSetup_x64_6.1.exe
- Windows 7 x64 - WindowsServerAppFabricSetup_x64_6.1.exe
Review the features that will be installed Make sure to check the log and verify that everything is installed Now you ready to configure the rest….problably the following update will be required before you can continue: Service pack update:http://support.microsoft.com/kb/980423 Configuration Assign or create the databases Choose the correct provider
Storage type | Storage location | Cluster management |
XML file | shared network folder | lead hosts |
SQL Server database | SQL Server | SQL Server (default) or lead hosts |
Custom provider | custom store | custom store |