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 options that already exist (such as Object Cache, BLOB Cache, and Page Output Cache) from the earlier versions of SharePoint. Distributed cache enables to quickly retrieve data 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
The good news is: You don't have to do anything to get distributed cache service features! When you install SharePoint 2013, distributed cache gets installed and configured automatically! The Distributed Cache service is built on Windows Server AppFabric, which is 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 the 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.
Should I Start Distributed Cache Service in All Servers of the Farm?
The Distributed Cache is started and run on all WFE and APP servers by default. 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 out of 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 is having four or more servers, starting distributed cache service in all servers results performance degrade, as per this Technet article https://technet.microsoft.com/en-us/library/jj891124.aspx
Get Distributed Cache Cluster-Servers:
Use this cmdlets to retrieve current cache setup:
Use-CacheCluster Get-CacheHostThis gets you the cache hosts, their 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:
Add-SPDistributedCacheServiceInstanceVerify 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.
A minimum of 8 GB and maximum of 16 GB can be allocated to the Cache. 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. 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 that are running the Distributed Cache service
How to Stop 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. In Service Applications
- Click Manage Services on Server. On the Services on 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.
The Distributed Cache service uses the following communication ports:
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. You have to actually remove the service from the servers instead of stopping it to remove it! Use this PowerShell cmdlet:
Remove-SPDistributedCacheServiceInstanceRun this cmdlet on server(s) that doesn't need to run the Distributed Cache service. This simply removes the current server from cache host and Services on Server for the selected server! Removing the Distributed cache service instance and this will stop the app fabric caching service in service.msc, as well.
You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.