Home
%3CLINGO-SUB%20id%3D%22lingo-sub-571633%22%20slang%3D%22en-US%22%3ESharePoint%20Tidbit%20-%20Quick%20write-up%20on%20monitoring%20SharePoint%20Distributed%20Cache%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-571633%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3EFirst%20published%20on%20TECHNET%20on%20Nov%2002%2C%202017%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20Hello%2C%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Here%20is%20some%20quick%20information%20around%20how%20to%20monitor%20the%20Distributed%20Cache%20Service%2C%20and%20gather%20some%20information%20from%20that%20service%20around%20usage.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20First%20of%20all%20let's%20understand%20how%20we%20can%20best%20look%20at%20the%20configuration%2C%20if%20we%20run%20the%20following%20script%20from%20any%20SharePoint%20server%20running%20the%20Distributed%20Cache%20Service%20we%20will%20see%20information%20for%20each%20partition%20in%20the%20Cache%20(There%20are%2011%20of%20them).%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20NOTE%3A%20The%20following%20needs%20to%20be%20run%20from%20an%20elevated%20PowerShell%20window%20%3CBR%20%2F%3E%20Use-CacheCluster%20%3CBR%20%2F%3E%20Get-AFCache%20%7C%20ForEach-Object%7BGet-AFCacheConfiguration%20-CacheName%20%24_.CacheName%7D%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113615i903D4A22E3F0AC7F%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Next%20lets%20run%20the%20following%20commands%20%3CBR%20%2F%3E%20Use-CacheCluster%20%3CBR%20%2F%3E%20Get-AFCacheHostConfiguration%20-ComputerName%20SP2016WFE02.weaver.ad%20-CachePort%2022233%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113616iA31CCBCB39F2FAE8%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20As%20you%20can%20see%20from%20the%20above%20screenshot%20my%20servers%20are%20each%20configured%20to%20use%20102%20MB%20of%20memory%20(Remember%20Distributed%20Cache%20is%20an%20in-memory%20cache)%2C%20but%20the%20question%20then%20is%20what%20does%20our%20usage%20actually%20look%20like%3F%26nbsp%3B%20Are%20we%20using%20all%20that%20memory%3F%26nbsp%3B%20How%20many%20objects%20are%20being%20stored%20in%20the%20cache.%26nbsp%3B%20To%20get%20that%20we%20can%20run%20the%20following%20script%20%3CBR%20%2F%3E%20Use-CacheCluster%20%3CBR%20%2F%3E%20Get-AFCache%20%7C%20ForEach-Object%7B%20%3CBR%20%2F%3E%20%24CacheName%20%3D%20%24_.CacheName%20%3CBR%20%2F%3E%20Get-AFCacheStatistics%20-CacheName%20%24CacheName%20%7C%20Add-Member%20-MemberType%20NoteProperty%20-Name%20'CacheName'%20-Value%20%24CacheName%20-PassThru%20%7D%20%3CBR%20%2F%3E%20%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F113617iA631DAAFB9E28516%22%20%2F%3E%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Now%20I%20can%20see%20my%20usage%20but%20the%20question%20is%20what%20do%20these%20properties%20mean%2C%20and%20TechNet%20comes%20to%20the%20rescue%20with%20%3CA%20href%3D%22https%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fazure%2Fmicrosoft.applicationserver.caching.hostcachestats_properties.aspx%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%20this%20information%3C%2FA%3E%20%3CBR%20%2F%3E%3CP%3EItemCount%20-%20The%20number%20of%20items%20in%20the%20cache.%20%3CBR%20%2F%3E%20MissCount%20-%20The%20number%20of%20cache%20misses%20for%20requested%20items%20that%20were%20not%20present%20in%20the%20cache.%20%3CBR%20%2F%3E%20NamedCacheCount%20-%20The%20number%20of%20named%20caches.%20%3CBR%20%2F%3E%20RegionCount%20-%20The%20number%20of%20regions.%20%3CBR%20%2F%3E%20RequestCount%20-%20The%20total%20number%20of%20requests.%20%3CBR%20%2F%3E%20Size%20-%20The%20size%20in%20bytes%20of%20cached%20items.%3C%2FP%3E%3CBR%20%2F%3E%20Pax%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-571633%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20TECHNET%20on%20Nov%2002%2C%202017%20Hello%2CHere%20is%20some%20quick%20information%20around%20how%20to%20monitor%20the%20Distributed%20Cache%20Service%2C%20and%20gather%20some%20information%20from%20that%20service%20around%20usage.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-571633%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDistributed%20Cache%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Emonitor%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Esp2013%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Esp2016%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Estats%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
First published on TECHNET on Nov 02, 2017
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