How to Increase Distributed Cache Memory Size in SharePoint 2013?

By default, the Distributed cache memory allocation size defaults to a value of 10% of total physical memory when SharePoint Server 2013 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 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:
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 2013? 
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 server. 
  • Locate and Click on "Stop" link next to Distributed Cache.
You can also use PowerShell to stop Distributed Cache Service instance.
$instanceName ="SPDistributedCacheService Name=AppFabricCachingService" 
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($ -eq $env:computername} 

#Or Use: Stop-SPDistributedCacheServiceInstance -Graceful

Step 2: Increase Distributed Cache Memory Size

You can increase size of the Cache with the following PowerShell Command. Login to any one of your SharePoint server which is part of Distributed cache cluster and run this command, it would set same Cache Size on all cache host on the farm including application servers if they are part of Cache cluster.
Update-SPDistributedCacheSize -CacheSizeInMB 1024
The maximum amount of memory that can be allocated to each cache host in the server farm is 16GB,  We cannot mention this value more than 40% of the system RAM. Ensure that the memory allocation assigned to the Distributed Cache service is the same on all servers that are running the Distributed Cache service. If you are running 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 ($ -eq $env:computername} 
Technet Reference: Manage the Distributed Cache service in SharePoint Server 2013

1 comment:

  1. 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?



Please Login and comment to get your questions answered!

Powered by Blogger.