Share via


SharePoint Tidbit - Quick write-up on monitoring SharePoint Distributed Cache

Hello,

Here is some quick information around how to monitor the Distributed Cache Service, and gather some information from that service around usage.

First of all let's understand how we can best look at the configuration, if we run the following script from any SharePoint server running the Distributed Cache Service we will see information for each partition in the Cache (There are 11 of them).

NOTE: The following needs to be run from an elevated PowerShell window

 Use-CacheCluster 
Get-AFCache | ForEach-Object{Get-AFCacheConfiguration -CacheName $_.CacheName}

Next lets run the following commands

 Use-CacheCluster
Get-AFCacheHostConfiguration -ComputerName SP2016WFE02.weaver.ad -CachePort 22233

As you can see from the above screenshot my servers are each configured to use 102 MB of memory (Remember Distributed Cache is an in-memory cache), but the question then is what does our usage actually look like?  Are we using all that memory?  How many objects are being stored in the cache.  To get that we can run the following script

 Use-CacheCluster 
Get-AFCache | ForEach-Object{     
$CacheName = $_.CacheName     
Get-AFCacheStatistics -CacheName $CacheName | Add-Member -MemberType NoteProperty -Name 'CacheName' -Value $CacheName -PassThru }

Now I can see my usage but the question is what do these properties mean, and TechNet comes to the rescue with this information

ItemCount - The number of items in the cache.
MissCount - The number of cache misses for requested items that were not present in the cache.
NamedCacheCount - The number of named caches.
RegionCount - The number of regions.
RequestCount - The total number of requests.
Size - The size in bytes of cached items.

Pax