Distributed Cache Service in SharePoint 2013 – Explained
What is Distributed Cache in SharePoint 2013?
The SharePoint Distributed Cache service is an additional caching mechanism introduced in SharePoint 2013 to support beyond the existing options (such as Object Cache, BLOB Cache, and Page Output Cache) from the earlier versions of SharePoint. Distributed cache enables quick data retrieval without any dependency on SQL databases, as everything is stored in memory.
The Distributed Cache service provides caching services for several features in SharePoint Server 2013. Some of the features that use the Distributed Cache service include:
- News feed
- OneNote client access
- Security Trimming
- Page load performance
How to Install SharePoint Distributed Cache?
The good news is: You don’t have to do anything to get distributed cache service features! When you install SharePoint 2013, the distributed cache gets installed and configured automatically! The Distributed Cache service is built on Windows Server AppFabric, a required component for SharePoint 2013 and is installed as part of the SharePoint 2013 prerequisite installer.
Distributed Cache service – Hosts – Cluster and Modes:
Any server in the farm running the Distributed Cache service is known as a cache host. A cache cluster is a group of all cache hosts in a SharePoint Server 2013 farm. A cache host joins a cache cluster when a new application server running the Distributed Cache service is added to the farm. When using a cache cluster, the Distributed Cache spans all application servers and creates one cache in the server farm. Distributed Cache service can be deployed in two modes:
- Dedicated mode
- Collocated mode.
When running in dedicated mode, the Distributed Cache service is started, and all other services are stopped on the server. In collocated mode, the Distributed Cache service is running along with other services on the server. The recommendation is to have dedicated servers hosting your cache for large-scale production use. If you have over 10000 users, you should look into a dedicated server (dedicated mode) Distributed Cache.
Should I Start Distributed Cache Service in All Servers of the Farm?
By default, the Distributed Cache is started and run on all WFE and APP servers. Running distributed cache on an already overtaxed server, such as SQL Server, search services, Excel Services, or Project Services, negates any benefit you may garner from the distributed cache. As per Microsoft: When the Distributed Cache service runs on a server together with other services and the server’s memory resources near 95% utilization, the Distributed Cache will start throttling requests. This means that the Distributed Cache service will no longer accept read and write requests until the server utilization reduces to approximately 70% utilization
If your farm has four or more servers, starting distributed cache service in all servers results in performance degradation, as per this TechNet article https://technet.microsoft.com/en-us/library/jj891124.aspx
Get Distributed Cache Cluster-Servers:
Use this cmdlet to retrieve the current cache setup:
This gets you the cache hosts, ports, service status, and version info.
How to Add Distributed Cache on a new server?
You can add a server to distributed cache host by running the cmdlet:
Verify the distributed cache Service:
- Go to: Central Administration >> Services on server >> Pick the relevant server >> Check Distributed cache service must be in Started state.
- Open Windows Services console (services.msc) > Locate “AppFabric Caching service”>> Make sure its Started.
Memory Allocation for Distributed Cache:
A minimum of 8 GB and a maximum of 16 GB can be allocated to the cache. On a server with more than 16 GB of total physical memory, allocate a maximum of 16 GB of memory to the Distributed Cache service. By default, the Distributed memory allocation size defaults to a value of 10 percent of total physical memory when SharePoint Server 2013 installs. You can change the memory allocation with the Update-SPDistributedCacheSize cmdlet. This allocation significantly affects the performance of the Distributed Cache service. Ensure that the memory allocation assigned to the Distributed Cache service is the same on all servers running the Distributed Cache service.
How to Stop or Restart Distributed Cache Service?
The Distributed Cache service can be stopped via the Central Administration. To stop (not remove) the Distributed Cache service by using Central Administration:
- In Central Administration, click Application Management
- On Service Applications Click Manage Services on Server. On the services on the server page, locate the Distributed Cache service.
- If the Distributed Cache service is started, and you want to stop the service, under Action, click Stop or restart.
Firewall configuration considerations
The Distributed Cache service uses the following communication ports:
How to Remove Distributed Cache Service?
To remove distributed cache service from the server, use PowerShell. Going to Services on Server from SharePoint Central Administration site and clicking “Stop” next to distributed just stops the service but doesn’t remove it from the cache cluster. To remove a server, You have to actually remove the service from the servers instead of stopping it! Use this PowerShell cmdlet: When you remove a server from the cache cluster, you must first perform a graceful shutdown on the server that you want to remove. This graceful shutdown transfers all cached data on the server to other servers within the cache cluster.
Stop-SPDistributedCacheServiceInstance -Graceful Remove-SPDistributedCacheServiceInstance
Run this cmdlet on the server(s) that doesn’t need to run the Distributed Cache service. This simply removes the current server from the cache host and Services on Server for the selected server! Removing the Distributed cache service instance will stop the app fabric caching service in service.msc, as well.
One thought on “Distributed Cache Service in SharePoint 2013 – Explained”
Hello Salaudeen. First I want to thank you for all the helpful posts. You are far and away the most cogent and helpful Sharepointer writing today.
I’ve always been leery of the AppFabric and the DCache. We have a small 3-tier 2016 on-prem farm where the WFE2 does not have the DCache running. If I understand your steps correctly, I should:
1. Run Add-SPDistributedCacheServiceInstance on the WFE2
2. Start the DCache service from Central Admin on the WFE2
3. Manually start the AppFabric from the services.msc
Sounds too simple/easy, which always scares me in SP.