SharePoint Blog

Change the memory allocation of the Distributed Cache service in SharePoint 2013

When SharePoint Server 2013 is installed, it assigns the Distributed Cache service 10 percent 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), 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.

You should increase the memory allocation of the Distributed Cache service in these scenarios:

When you add physical memory to the server. The Distributed Cache service does not automatically recalculate the 10% memory allocation, so when you increase the total physical memory on the server, you have to manually increase the Distributed Cache service’s memory allocation.

When your server farm has a dedicated Distributed Cache server. Use the following method to calculate how much memory can be assigned to the Distributed Cache service:
1. Determine the total physical memory on the server. For this example, we will use 16 GB as the total physical memory available on the server.

2. Reserve 2 GB of memory for other processes and services that are running on the cache host. For example, 16 GB – 2 GB = 14 GB. This remaining memory is allocated to the Distributed Cache service.

3. Take half of the remaining memory, and convert it to MB. For example, 14 GB/2 = 7 GB or 7000 MB. This is the cache size of the Distributed Cache service.

4. Use the following procedure to update the memory allocation accordingly.

Change the memory allocation of the Distributed Cache
Use this procedure to reconfigure the memory allocation of the cache size of the Distributed Cache service.

1. (Optional) To check the existing memory allocation for the Distributed Cache service on a server, run the following command at the Windows PowerShell command prompt:
Use-CacheCluster
Get-AFCacheHostConfiguration -ComputerName ComputerName -CachePort “22233”
Where: ComputerName is the computer name of the server that you are running the PowerShell cmdlet on.

2. Stop the Distributed Cache service on all cache hosts. To stop the Distributed Cache service, go to Services on Server in Central Administration, and Stop the Distributed Cache service on all cache hosts in the farm.

3. To reconfigure the cache size of the Distributed Cache service, run the following command one time only on any cache host at the Windows PowerShell command prompt:
Update-SPDistributedCacheSize -CacheSizeInMB CacheSize
Where: CacheSize is the cache size’s memory allocation assignment in MB. In the previous example, the cache size was calculated at 7000 MB for a server with 16 GB of total memory.

4. Restart the Distributed Cache service on all cache hosts. To restart the Distributed Cache service, go to Services on Server in Central Administration, and Start the Distributed Cache service on all cache hosts in the farm.