Alexander's Blog

Sharing knowledge with the global IT community since November 1, 2004

Distributed Cache Service in SharePoint Server 2013

/
/
ad-mania

In SharePoint Server 2013, there are a couple of new services that improve server performance: Distributed Cache service and the AppFabric Caching service. In this article I will focus on the Distributed Cache service which is a customized version of Windows AppFabric.

What is Distributed Cache Service?

The Distributed Cache service in SharePoint Server 2013 provides in-memory caching services to several SharePoint features including:

  1. Authentication
  2. Newsfeeds
  3. OneNote client access
  4. Page load performance
  5. Security Trimming

These features use the Distributed Cache in memory to quickly retrieve the data. The Distributed Cache service has no
dependency on SharePoint databases that are stored in the SQL Server. In other words, nothing is stored in databases, everything is stored in memory. There are some other types of caches that SharePoint uses, such as Blob cache and Output cache but they don’t depend on the Distributed Cache. The Blob Cache is used for caching files (images, JavaScripts, etc.) and is a disk-based cache. The Output Cache is an ASP.NET feature used on Web Front End servers to cache Web pages.

The Distributed Cache deployment requires proper planning. It is likely to take you longer to plan, deploy, configure and test the Distributed Cache service properly in an enterprise environment than installing and configuring SharePoint Server 2013. Before you deploy this service, download this planning flow chart from Microsoft.

WARNING! If you don’t deploy the Distributed Cache service per Microsoft’s instructions in this article, Microsoft warns that in extreme scenarios you may have to rebuild the server farm. Yes, I did say rebuild the server farm, not just rebuild the Distributed Cache.

Here are some important points to note when working with Distributed Cache.

  1. At the time of installation, SharePoint Server 2013 assigns 5% of the total physical memory on the server to the Distributed Cache service (also known as cache size).
  2. You must have at least one cache host running the Distributed Cache service in a SharePoint Server 2013 farm. Therefore, if you only have one SharePoint server then it must run the Distributed Cache service.
  3. The maximum amount of memory that can be allocated to the Distributed Cache service’s cache size is 16GB per cache host in the server farm.
  4. The maximum number of hosts that you can have in a cluster is 16.
  5. Do not allocated more than 16GB to the cache size on any server or else the server may freeze for more than 10 seconds.
  6. In case of virtualization, do not configure the Distributed Cache server for dynamic memory. Microsoft doesn’t support such configuration. In plain English, this means that you should never use dynamic memory in Hyper-V for your SharePoint servers if they are running the Distributed Cache service.
  7. At about 95% memory consumption, the Distributed Cache service starts to throttles requests. At this point it refuses to accept any cache read and write requests until the memory utilization drops down to about 70%.

CAUTION! You should not manage the AppFabric Caching Service from the Services Console (services.msc). You should also avoid using the applications in the folder named AppFabric for Windows Server on the Start menu.

Dealing with the Distributed Cache Warning & Error

Depending on your server configuration, at times you may see the following warning in the SharePoint Health Analyzer Report that is related to the Distributed Cache service.

DistributedCacheWarning

This Distributed Cache host may cause cache reliability problems

The Distributed Cache service on this cache host has been stopped but has not been unregistered from the farm. To avoid reliability issues, we recommend that you either start the Distributed Cache service on the server, or remove the cache host from the cache cluster.

Solution #1: If you have deployed Distributed Cache service and it has stopped then you can start the service by using the following PowerShell script: Add-SPDistributedCacheServiceInstance. Then go to Central Administration -> Application Management -> Service Applications -> Manage services on server and make sure the Distributed Cache service is listed and has started.

DistributedCacheService

Solution #2: If you have not deployed Distributed Cache service or don’t want to run this service then you should remove the cache host from the cache cluster (i.e. unregister from the server farm) like the Health Analyzer error points out. What is a cache host? Any server in the farm that is running the Distributed Cache service is called a cache host. A cache cluster is simply a group of all the cache hosts in a SharePoint Server 2013 farm. Use the following PowerShell command to do that: Remove-SPDistributedCacheServiceInstance. This will also stop and disable the associated AppFabric Caching service. Go to Central Administration -> Application Management -> Service Applications -> Manage services on server and make sure the Distributed Cache service is no longer listed there.

See the reference to the TechNet document at the end of this article for more details.

You may also notice the following error in the Health Analyzer Report: Distributed Cache is not enabled in this deployment.

DistributedCacheError

SOLUTION: Enable Distributed Cache service. You can click on the hyperlink in the Remedy section to get more information by going to the SharePoint Health Analyzer rules reference.

Do I Have to Run the Distributed Cache Service?

You may be wondering do I really have to deploy this service? What if I have a small business and I don’t want to go through all this trouble of setting up a cache cluster and tweaking the service? The simple answer is yes. According to Microsoft, the Distributed Cache service is either required by or improves performance of the five features that I have listed at the beginning of this article.

Microsoft has designed SharePoint Server 2013 to rely on certain services to improve server performance. Every new version of server requires more memory, disk space and other resources than the previous one and SharePoint Server 2013 is no exception. For small businesses it may be not feasible to meet all the requirements and overhead of Distributed Cache. Keep in mind that the Distributed Cache service depends on the AppFabric service which requires a dedicated server. Microsoft recommends that Windows Server AppFabric cache hosts should be dedicated to the caching service, which means that those servers should not be used as application, Web, or database servers. It is possible to use non-dedicated cache servers in a cluster but Microsoft doesn’t support such scenarios. See this MSDN article for more details. Another thing to keep in mind is that the High Availability feature of the AppFabric Server caching features requires all nodes in the cache cluster to be running Windows Server Enterprise Edition or higher. I know several small business clients that cannot afford Windows Server Enterprise Editions or higher for their small businesses. So the bottom line is this. For some small businesses it may be difficult to run the Distributed Cache service in SharePoint Server 2013 because of all the reasons I have listed but it looks like Microsoft has designed SharePoint Server 2013 to use Distributed Cache service and if you don’t run the service your SharePoint server won’t be a happy camper.

Don’t deploy this service halfheartedly hoping that if works half the time you will gain some benefits. If you don’t have time, money and staff to keep this service running like a charm it can potentially destroy your server farm. That’s not just me scaring you, that’s Microsoft warning you. I am just the messenger <smile>. If you can’t afford the time and resources required to deploy Distributed Cache service I feel your pain. I believe you are a good candidate for Office 365, which includes SharePoint 2013. You won’t have too much control over your server farm but Office 365 is very affordable and fairly reliable.

References:

Manage the Distributed Cache Service in SharePoint Server 2013

The Distributed Cache host may cause cache reliability problems

SharePoint Health Analyzer rules reference (SharePoint 2013)

Windows Server AppFabric Caching Physical Architecture Diagram

SharePoint 2013: AppFabric and Distributed Cache Service


Copyright ©2014 Zubair Alexander. All rights reserved.

  • Facebook
  • Twitter
  • Linkedin

Leave a Comment

Your email address will not be published. Required fields are marked *

This div height required for enabling the sticky sidebar