Points to consider with Distributed Cache on SharePoint 2013 [UPDATED]

Hi

I would like to highlight some points concerning Distributed Cache and SharePoint 2013: 

  • A SharePoint Farm that has the distributed Cache Service disabled on all server is not supported. That means your Support Will be Limited when opening Pemier Cases and you can't escalate or ask for a bug fix.

You disable Distributed Cache in a farm configuration.

https://support.microsoft.com/en-us/kb/2764086

  • NEVER admin the distributed cache from the admin console.

The Distributed Cache service can end up in a nonfunctioning or unrecoverable state if you do not follow the procedures that are listed in this article. In extreme scenarios, you might have to rebuild the server farm. The Distributed Cache depends on Windows Server AppFabric as a prerequisite. Do not administer the AppFabric Caching Service from the Services window in Administrative Tools in Control Panel. Do not use the applications in the folder named AppFabric for Windows Server on the Start menu.

https://technet.microsoft.com/en-us/library/jj219613.aspx

  • Maximum capacity of memory is 16 GB per host 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. If you allocate more than 16 GB of memory to the Distributed Cache service, the server might unexpectedly stop responding for more than 10 seconds.  

https://technet.microsoft.com/library/jj219572%28office.15%29.aspx

  • Dynamic memory is not supported in SharePoint 2013 environments nor APP fabric servers.

The Distributed Cache service can run on either a physical or virtual server. When using virtualization, do not use Dynamic Memory to manage shared memory resources among other virtual machines and the Distributed Cache servers. The memory allocation for virtualized Distributed Cache servers must be fixed.  

https://technet.microsoft.com/en-us/library/jj219572.aspx

  • The product after being installed allocates 10% of the physical RAM memory available at the sever. It can be configured following the next point.  
  • Recomended not to run Distributed Cache in same server as:
    • SQL Server 2008 or SQL Server 2012
    • Search service
    • Excel Services in SharePoint
    • Project Server service

                        https://technet.microsoft.com/en-us/library/jj219572(v=office.15).aspx 

  • It's recommended to allocate 2 GB for other services. For calculate the amount of memory you can apply following statement

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.

                                     https://technet.microsoft.com/en-us/library/jj219613.aspx

  • It's not supported to develop code against the Dsitributed Cache of SharePoint 2013.

https://blogs.msdn.com/b/calvarro/archive/2013/06/05/supportability-of-custom-developments-in-sps-2013-and-appfabric-cache.aspx

  • Code errors that you can face when managing Distributed Cache via PowerShell command lets

https://msdn.microsoft.com/es-es/library/ff921008(v=azure.10).aspx

  • Install the latest APP Fabric CU if possible. Right now we are in CU 4

                  https://support.microsoft.com/kb/2800726 

  • Install latest APP Fabric CU if possible. Right now we are in CU 6

                 https://support.microsoft.com/en-us/kb/3042099

After installing the update you should do the following in all the servers that are holding the distributed cache

After you apply this cumulative update, AppFabric uses a nonblocking garbage collection (background server garbage collection). Nonblocking garbage collection is a new feature in the .NET Framework 4.5.

To apply this fix, follow these steps:

1. Upgrade the servers to the .NET Framework 4.5.
2. Install the cumulative update package.
3. Enable the fix by using the following setting <appSettings><add key="backgroundGC" value="true"/></appSettings> in the DistributedCacheService.exe.config file between

       </configSections>

   <appSettings><add key="backgroundGC" value="true"/></appSettings>

   ``<dataCacheConfig>

4. Restart the AppFabric Caching service for the update to take effect.
Note By default, the DistributedCacheService.exe.config file is located under the following directory:

%ProgramFiles%\AppFabric 1.1 for Windows Server 

  • Good article from my fellow colleague Sam Betts about how to troubleshoot issues with the Distributed Cache and SharePoint 2013

https://blogs.msdn.com/b/sambetts/archive/2014/03/19/sharepoint-2013-distributed-cache-appfabric-troubleshooting.aspx

  • Maybe you'll need to tune up the timeout settings, max buffer etc settings of the distributed cache containers. Example for the DistributedLogonTokenCache.

Get-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache
$DLTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache
$DLTC.maxBufferPoolSize = "1073741824"
$DLTC.maxBufferSize = "33554432"
$DLTC.requestTimeout = "3000"
$DLTC.channelOpenTimeOut = "3000"
$DLTC.MaxConnectionsToServer = "100"
Set-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache $DLTC
Restart-Service -Name AppFabricCachingService

Product Group update how to tune the Distributed cache please follow Fine-tune the Distributed Cache service by using a Windows PowerShell section  https://technet.microsoft.com/en-us/library/jj219613.aspx

 THX.

Kind Regards.

Héctor Calvarro Martín. SharePoint Dev/Core. EMEA Premier Field Engineer.