Ehcache Monitoring

Monitor the performance of your Java EEE Ehcache caches using Site24x7 plugin.

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:

Object count

Use the metric 'ObjectCount' and get detailed count of the total number of elements/objects stored in the cache of your Ehcache server.

Cache hits

'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.

Cache Misses

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

Prerequisites:

  • 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:
    Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999
    Dcom.sun.management.jmxremote.ssl=false
    Dcom.sun.management.jmxremote.authenticate=false

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 repositoryand place it under the "ehcache" directory
    cd ehcache
    sudo wget https://raw.githubusercontent.com/site24x7/plugins/master/ehcache/ehcache.sh
    sudo 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 = None
    PASSWORD = None
  • Save the changes and restart the agent.
    /etc/init.d/site24x7monagent restart

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")

Related plugins:

  • 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