SharePoint 2013: Distributed Cache (AppFabrikCache) part 2/2

SharePoint 2013: Distributed Cache (AppFabrikCache) part 2/2


A few weeks ago I wrote an article about AppFabric Cache aka Distributed Cache. It’s time to continue about AppFabric Cache. If you didn’t read the previous article please hit the following link:

A little reminder about AppFabric Cache: This new way of caching was originally based on the “Cloud” of Microsoft (Azure) but has been integrated on the On Premise systems of Microsoft. The Distributed Cache can be deployed on 2 different ways

  • Dedicated Mode
  • Collocated Mode

On the dedicated mode only this service is running on the application server and all other services are stopped who is hosting the AppFabric Cache Service.

On The Collocated mode the Distributed Cache is running with all other Service Applications on the Application Server. This is the recommended mode for deploying Distributed Cache.

Debug of Cache

Via Central Administration:

  • Open Central Administration and hit Application Management
  • From Service Applications, hit Manage Services on Server
  • Select Distributed Cache Service
  • Hit START or STOP to start or stop your service

Via PowerShell:

At the Windows PowerShell command prompt, run the following command:

$instanceName = “SPDistributedCacheService Name = AppFabricCachingService”
$serviceInstance = Get-SPServiceInstance | ? {( $_.service.tostring()) –eq $instanceName –and ($ –eq $env:computername




Allocate Memory on Distributed Cache Service

When SharePoint Server 2013 is installed, 10% of the total physical memory is allocated. The Distributed Cache service use 50% of this memory as storage and the other to manage the memory.

This cache size can be increased when:

  • You add more memory on the Server
    • Be aware; when you add memory to the server, the Distributed Cache isn’t updating by himself. You need to reconfigure the Cache Size.
  • If you have a dedicated caching server
    • You should calculate it so :
      • Determine the total sum of physical memory. Let’s take the example that your server has 16GB of memory.
      • You have to book 2GB of memory for other processes. So this means 16GB – 2GB = 14GB
      • Now we have to take the half of this amount and that size is our AppFabric Cache Size : 14GB / 2 = 7GB
      • Again, as said on the previous post ; the total size of memory should never be more than 16GB

Change the Memory allocation

Use this procedure to reconfigure the memory allocation of Cache Size

Get-APCacheHostConfiguration –ComputerName –CachePort « 22233 »


  • Stop the service via Central Administration
  • Update-SPDistributedCacheSize –CacheSizeInMB CacheSize
    • If we take our example ; you have to fill 7000 MB for a server who has 16GB or RAM
  • Start the service via Central Administration

Add or Delete a server on a Distributed Cache Cluster

When you want to delete an AppFabric Server from the cluster, be aware that the service is stopped from the Central Administration and then execute the folling commands via PowerShell:

Adding: Add-SPDistributedCacheServiceInstance
Deleting: Remove- SPDistributedCacheServiceInstance


Graceful shutdown of the Distributed Cache Service

In SharePoint 2013, a cluster cache exists when one or many machines are running the Distributed Cache Service.

When you have to do maintenance on your platform, the possibility exists that you have to remove a server from the Distributed Cache Cluster.

You have to run the following command (graceful) on the server that you want to remove.

Stop-SPDistributedCacheServiceInstance – Graceful

This operation can take more than 15 minutes. The graceful option will prevent losing any data.

Change the Managed Account

When SharePoint Server 2013 is installed the Managed Account of Distributed Cache is the same as the Installation Account (PEGASUS\SPInstall_GA). You can change this with Powershell commands:


$farm = Get-SPFarm
$cacheService = $farm.Services | where {$_.Name –eq “AppFabricCachingService”}
$account = Get-SPManagedAccount –Identity Pegasus\USER_NAME
$cacheService.ProcessIdentity.CurrentIdentityType = “USER”
$cacheService.ProcessIdentity.ManagedAccount = $account



Repair a Cache host

After an installation or maintenance of your cluster, the Distributed Cache can be non-operational. You can repair this again with PowerShell:

$var = Get-SPServiceInstance GUID OF APPFABRICK

What you need to retain? (Summary)

  • Do not give more than 16GB for you Distributed Cache Service and not more than 16 machines for your cluster
  • Pray attention when changing anything and use the Graceful option to prevent data loss
  • Never give Dynamic memory but always static memory
  • Never ignore alerts in Health Analyzer

Please read here the part 1:
Leave a Comment
  • Please add 2 and 3 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
  • Gokan Ozcifci edited Revision 2. Comment: Added Content

Page 1 of 1 (1 items)
Wikis - Comment List
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
  • Gokan Ozcifci edited Revision 2. Comment: Added Content

Page 1 of 1 (1 items)