Ehcache is the most widely-used Java based cache service. Configure Site24x7 Ehcache monitoring plugin and monitor the performance of your caches.
This document details how to configure the Ehcache plugin and the monitoring metrics for providing in-depth visibility into the performance, availability, and usage stats of Ehcache servers.
Ehcache performance monitoring metrics:
Take informed troubleshooting decisions by keeping track of critical metrics including:
Use the metric 'ObjectCount' and get detailed count of the total number of elements/objects stored in the cache of your Ehcache server.
'CacheHits' gives us the total number of times a requested item was found in the cache of your Ehcache server. Use the metric to understand the success rate of your system.
The metric 'CacheMisses' gives us the total number of times a requested element was not found in the cache.
Cache hit percentage
The metric 'CacheHitPercentage' gives us the percentage of successful hits that ocurred in the cache.
Cache miss percentage
The metric 'CacheMissPercentage' gives us the percentage of accesses that failed to find anything in the cache.
How it works?
- Log-in to your Site24x7 account. Sign up here if you don't have one
- Download and install the latest version of Site24x7 Linux agent
- Install the Ehcache plugin
- The agent will execute the Ehcache plugin and push the data to the Site24x7 server
- For monitoring Ehcache, your application must register CacheStatistics in the JDK platform MBeanServer. Below is the sample code for how to register MBeanServer:
CacheManager manager = new CacheManager();MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();ManagementService.registerMBeans(manager, mBeanServer, false, false, false, true);
- JMX creates a standard way of instrumenting classes which makes them available to a monitoring infrastructure. To enable JMX, please execute the below arguments in your application:
Ehcache plugin installation:
- Create a directory "ehcache", under the Site24x7 Linux agent's plugin directory - /opt/site24x7/monagent/plugins/
cd /opt/site24x7/monagent/plugins/sudo mkdir ehcache
- Download the files "ehcache.sh" and "EhcachePlugin.java" from our GitHub repository and place it under the "ehcache" directory
cd ehcachesudo wget https://raw.githubusercontent.com/site24x7/plugins/master/ehcache/ehcache.shsudo wget https://raw.githubusercontent.com/site24x7/plugins/master/ehcache/EhcachePlugin.java
Ehcache plugin configuration:
- Configure host and port values for the Ehcache plugin
Eg :HOST = "localhost"ADMINPORT = "4848"USERNAME = NonePASSWORD = None
- Save the changes and restart the agent.
Monitoring additional metrics:
- To monitor additional metrics, edit the "ehcache.sh" file and add the new metrics that need monitoring
- Increment the plugin version value in the file "ehcache.sh" to view the newly added metrics ( For e.g. Change the default plugin version from PLUGIN_VERSION = "1" to "PLUGIN_VERSION = "2")
- Redis plugin - Monitor performance metrics of your Redis databases
- MongoDB plugin - Monitor performance metrics of your MongoDB databases
- Memcached plugin - Analyze performance of your Memcached server
- Nagios plugin - Execute thousands of Nagios plugins in Site24x7 without the need of running a Nagios server
- Out-of-the-box plugins - Monitor your entire app stack with our extensive list of integrations
- Create custom plugins - Create custom Linux and Windows plugins and monitor custom attributes