Today I did some work with one of my customers around the distributed cache, and just wanted to discuss it with you a bit.
First the service is a local service and not a service application, so when you do anything to it you are affecting the single server.
Second servers are combined into a Cache cluster, and all servers in the cluster maintain a piece of the single cache which works farm wide.
Third every server added to the farm is automatically added to the cache. Although you can remove it if you desire.
A question that my customer asked me was 'What is this cache for?' what a great question because really SharePoint has a ton of caches and each one has it's specific use. To answer this question we have to review a bit of SharePoint History when a user logs into a site they will hit a specific Web Front End. And assuming you have multiple servers behind a load balancer, it is possible that they could be forced over to another Web Front End and have to log back in. To deal with this in SharePoint 2007/2010 we recommended using Sticky Sessions so that the Load Balancer forces the client back to the same server. In SharePoint 2013 we recommend you Do not use Sticky sessions because this cache stores your authentication token, so no matter which Web Front End you hit the server will have access to your token. The cache does store other data for your social feed, so be aware of that when manipulating this service.
This cache is in-memory which means it is faster but of course that means that it consumes more memory with more usage, due to the nature of the cache Microsoft does have some best practices:
Servers running this service should not have more then 16GB of memory
It is recommended that you have at least two servers running this service, when possible these servers should be dedicated to this service.
When rebooting a server, you must copy it's dataset to another server in the cluster or lose it.
To help administrators work with this service, the Product Group has created several PowerShell cmdlet's and I will quickly list them here
Stop-SPDistributedCacheServiceInstance – You would use this cmdlet with the switch '-graceful' to copy the dataset to another server before reboot. (See http://technet.microsoft.com/en-us/library/jj730443.aspx)
Remove-SPDistributedCacheServiceInstance – Removes the server from the cluster. (See http://technet.microsoft.com/en-us/library/jj730452.aspx)
Add-SPDistributedCacheServiceInstance – Adds the server to the cluster. (See http://technet.microsoft.com/en-us/library/jj730445.aspx)
Interesting articles about the cache:
Plan for feeds and the Distributed Cache service in SharePoint Server 2013
AppFabric Caching (and SharePoint): Configuration and Deployment (Part 2)
AppFabric Caching and SharePoint: Concepts and Examples (Part 1)