How to Increase the Distributed Cache Memory Size in SharePoint Server?

By default, the Distributed cache memory allocation size defaults to a value of 10% of total physical memory when SharePoint Server 2016 installs. The Distributed Cache service uses half of that memory allocation for data storage (also known as cache size, 5% cache size). You can change the memory allocation as it significantly affects the performance of the Distributed Cache service. Or you may want to change the memory allocation if you have added more memory to your SharePoint servers after SharePoint is installed.

Get Distributed Cache Memory Allocation size:

To get the current memory allocation of Distributed Cache, use:

Use-CacheCluster  
Get-AFCacheHostConfiguration -ComputerName $env:computername -CachePort "22233"
Increase Distributed Cache Memory Size in SharePoint 2013

SharePoint 2013 distributed Cache is explained in my another article: Distributed Cache Service in SharePoint 2013 – Explained

How to Change  Distributed Cache Memory Size in SharePoint 2016? 

To Change distributed cache memory settings, follow these steps:

  1. Stop the Distributed Cache service on all cache hosts in the farm.
  2. Change the cache size of the Distributed Cache service using: Update-SPDistributedCacheSize cmdlet
  3. Start the Distributed Cache service on all cache hosts in the farm

Step 1: Stop Distributed Cache Service:

Follow these steps on each host to stop distributed cache service.

  • Go to SharePoint 2013 Central Administration >> System Settings >> Manage services on the server. 
  • Locate and click on the “Stop” link next to Distributed Cache.

You can also use PowerShell to stop Distributed Cache Service instances.

$instanceName ="SPDistributedCacheService Name=AppFabricCachingService" 
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername} 
$serviceInstance.Unprovision()

#Or Use: Stop-SPDistributedCacheServiceInstance -Graceful

Step 2: Increase Distributed Cache Memory Size

You can increase the size of the Cache with the following PowerShell commands. Login to any one of your SharePoint servers that is part of the distributed cache cluster, and run this command. It would set the same Cache Size on all cache hosts on the farm, including application servers if they are part of the cache cluster.

Update-SPDistributedCacheSize -CacheSizeInMB 1024

The maximum amount of memory that can be allocated to each cache host in the server farm is 16 GB. We cannot mention this value as more than 40% of the system RAM. Ensure that the memory allocation assigned to the Distributed Cache service is the same on all servers running the Distributed Cache service. If you run a small farm with <10k users in collocated mode, 1 GB of RAM should be enough. For dedicated mode, use the formula given in the TechNet article below.

Step 3: Start the Distributed Cache service

Start the Distributed Cache service on each host using:

  • Central Administration >> System Settings >> Manage services on server.
  • Locate and Start Distributed cache service. 

Using PowerShell to Start Distributed Cache Service Instance:

$instanceName ="SPDistributedCacheService Name=AppFabricCachingService" 
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername} 
$serviceInstance.provision()

TechNet Reference: Manage the Distributed Cache service in SharePoint Server 2013

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

One thought on “How to Increase the Distributed Cache Memory Size in SharePoint Server?

  • Hi Rajack,

    I got an error in Event Viewer about Distributed Cache, see below:

    The Execute method of job definition Microsoft.Office.Server.UserProfiles.LMTRepopulationJob (ID xxxxxx-xxx-xxxx-xxxx-xxxxxxx) threw an exception. More information is included below.
    Unexpected exception in FeedCacheService.IsRepopulationNeeded: Cache cluster is down, restart the cache cluster and Retry.

    Can you solve this?

    Thanks

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *