Monitor Caches in PowerShell
Both local and clustered caches publish performance statistics. In this step, you will verify that the Stress Test tool that you ran in previous step is making cache calls successfully.
NCache provides a set of PowerShell cmdlets to support monitoring of cache health and performance statistics.
Pre-requisite
Your NCache service should be started before you start monitoring caches. If the service is not started, type the following command in a terminal to start NCache service:
> sudo systemctl start ncached
Monitor Cache Server Statistics
Use the Get-CacheServerStatistics cmdlet to get a list of all performance counters for the specified cache. This shows default counters but can be extended to get a list of custom counters.
Important
These counters can also be saved in Excel as a .CSV file to be viewed later. You can also convert this .CSV file to a .BLG file which can be viewed in Performance Monitor in a Windows environment.
- The following command displays the default counters for the cache demoClusteredCache continuously after every default sample interval.
Get-CacheServerStatistics -CacheName demoClusteredCache -Continuous
- The following command saves the counters for demoClusteredCache in a CSV format at the specified path.
Get-CacheServerStatistics -CacheName demoClusteredCache -Format csv | Out-File -Encoding ascii "<your-location>\test.csv"
For more options on how to use this tool, refer to PowerShell Reference.
Monitor Cluster Health
Get-ClusterHealth cmdlet lists all nodes registered on cache specified. This cmdlet displays:
- Status of the cache (Running/Stopped)
- Connection Status
- Number of connected clients
Following example uses Get-ClusterHealth
and displays the nodes of the cache, status, connection and number of connected clients for demoClusteredCache.
Get-ClusterHealth -CacheName demoClusteredCache
For more detail on how to use this tool, refer to PowerShell Reference.
See Also
Create a Cache
Simulate Cache Usage
Use NCache from .NET Application
Use NCache for ASP.NET Sessions