Note: This article is part of series of articles showcasing different approaches & variations to adjust cache size of the SharePoint 2013 Distributed Cache service using PowerShell commands – Set-AFCacheHostConfiguration and Update-SPDistributedCacheSize.
This is overview article and provides background information on why and what method you should use to adjust cache size of SharePoint 2013 Distributed Cache Service.
Next Article in this series –
- Adjust Cache Size of the SharePoint 2013 Distributed Cache Service Part II – Using Set-AFCacheHostConfiguration Command
- Adjust Cache Size of the SharePoint 2013 Distributed Cache Service Part III – Using Set-Update-SPDistributedCacheSize Command
Fine tuning and adjusting Distributed Cache size on SharePoint 2013 farm would be one of the most frequent and often ignored SharePoint administrative tasks. If you are the SharePoint administrator managing SharePoint 2013 farm, you must take Distributed Cache service seriously. Microsoft has released first ever official warning in SharePoint Products history – “The Distributed Cache service can end up in a non-functioning or unrecoverable state if you do not follow the procedures that are listed in this article – http://technet.microsoft.com/en-us/library/jj219613.aspx. In extreme scenarios, you might have to rebuild the server farm.”
There are various aspects of managing Distributed Cache service but one of the most important would be allocating proper memory & adjusting cache size for Distributed Cache service. There are various reasons why you would adjust default Cache Size of SharePoint 2013 Distributed Cache Service.
- When SharePoint Server 2013 is installed, it assigns the Distributed Cache service 10% of the total physical memory on the server. The Distributed Cache service uses half of that memory allocation for data storage (also known as cache size, 5% cache size), and the other half of that memory allocation is used for memory management overhead. When the cached data grows, the Distributed Cache service uses the entire 10 percent of the allocated memory. In most cases, initial 5% cache size may not be enough and you may require to increase cache size to support various SharePoint features. e.g. when you install SharePoint 2013 on 8 GB RAM (8192 MB RAM), it would allocate 410 MB (5% of 8GB RAM) to the Distributed Cache size. This may not be enough to support 50 concurrent user’s My Site activities and it may require to increase the Distributed Cache size.
- On a server that has more than 16 GB of total physical memory, allocate a maximum of 16 GB of memory to the Distributed Cache service. If you allocate more than 16 GB of memory to the Distributed Cache service, the server might unexpectedly stop responding for more than 10 seconds. If the cache host’s size is larger than 16GB/8GB, garbage collection could take long enough to cause a noticeable interruption for clients. This is interesting and most probably more common scenario in Production farm. e.g. If server running Distributed Cache service have 32 GB RAM allocated, you must change Distributed Cache memory allocation to maximum to 16 GB (8 GB Cache Size).
- During ongoing SharePoint farm maintenance, when you add physical memory to the server, Distributed Cache service does not automatically recalculate the 10% memory allocation. So, when you increase or decrease the total physical memory on the server, you have to manually increase or decrease the Distributed Cache service’s memory allocation.
You may ask, Ok, I understood why I need to adjust default cache size of SharePoint 2013 Distributed Cache Service but what would be ideal cache size allocated to my SharePoint server running Distributed Cache service. In most cases – I would say it depends.
- If you are running Distributed Cache on one of the application servers running Search, it would be hard to calculate ideal memory allocation. Microsoft recommends not running Distributed Cache on application servers along with Search and other service applications.
- If you are running Distributed Cache on dedicated server, I would suggest to work through Microsoft formula.
- For 24 GB RAM SharePoint server running only Distributed Cache service in dedicated mode, you shouldn’t be allocating more than 8 GB RAM cache size (remember 16 GB is max recommended total memory allocation) to the Distributed Cache.
- For 16 GB RAM SharePoint server running only Distributed Cache service in dedicated mode, you shouldn’t allocate more than 7 GB RAM cache size (16 GB – 2 GB for server OS memory = 14 GB Distributed Cache memory allocation) to the Distributed Cache.
- If you are running Distributed Cache on collocated mode on web front end servers, please plan to ensure additional memory required by SharePoint foundation Web Application service and any other additional incoming user requests processes overhead.
TechNet has brilliant guidelines on how to change and measure Distributed Cache Size on SharePoint 2013 but as always, it’s missing some of the finer details. Although there are various different PowerShell commands available to adjust memory allocation for Distributed Cache SharePoint Service (App Fabric Cache Windows Service) including Update-SPDistributedCacheSize (SharePoint 2013 cmdlet), Set-AFCacheHostConfiguration (Windows Server AppFabric 1.1 cmdlet), and Set-CacheHostConfig (Windows Server AppFabric 1.0 cmdlet), TechNet has demonstrated only somewhat limited but much more preferred Update-SPDistributedCacheSize approach. In my article, I won’t explain adjusting Distributed cache size using Set-CacheHostConfig command. SharePoint 2013 Distributed Cache is based on Microsoft AppFabric 1.1 for Windows Server. Not only because Set-CacheHostConfig may not work (works fine in Single Server SharePoint farm VM for developer machines, haven’ tested for multi-cache hosts scenarios) but it’s previous version of Windows Server AppFabric 1.0 cmdlet.
Josh Gavant from Microsoft has brilliant two parts article to explain difference between these two commands and when and why you would choose one option or other. Essentially, you would run Update-SPDistributedCacheSize (preferred approach for SharePoint Distributed Cache service as per TechNet) when you would like to configure same cache memory size on all the Cache host on Cache cluster and use Set-AFCacheHostConfiguration (equally works great and my preferred approach) when you would like to adjust cache memory allocation to different sizes for different Cache host in Cache cluster.
In next articles of this series, I will walk through different scenarios & use cases and step by step guides to change cache size using both Set-AFCacheHostConfiguration and Update-SPDistributedCacheSize commands. In my book, both options are valid but one option might be better than other in your given scenario.
Stay tuned for two more articles on this series!!!!
- Manage the Distributed Cache service in SharePoint Server 2013 – http://technet.microsoft.com/en-us/library/jj219613.aspx
- Josh Gavant’s App Fabric Caching and SharePoint Part I and II – http://blogs.technet.com/b/mspfe/archive/2013/04/02/appfabric-caching-and-sharepoint.aspx
- Calculate and Set Distributed Cache Size – http://blogs.technet.com/b/sp/archive/2013/05/29/calculate-and-set-distributed-cache-size.aspx