How to check how many times cache entries are evicted in RHDG?

Solution Verified - Updated

Environment

  • Red Hat Data Grid (RHDG)
    • 7.x

Issue

  • Is there a logging to see what entries evicted from a cache?
  • Is there a way to know whether eviction take effect?

Resolution

There is no log message to see whether an entry with a special key is evicted, this is not possible as the server must know how to handle the key serialization.

There is a statistic per cache on how many evictions happened during the lifespan of the instance.
Consider that the number of evicted entries is local to the instance and differ on each instance as each instance will be used differently and therefore will evict different entries and a different amount.

For the server there is an attribute evictions per cache which can be read with the following CLI commands:

  • in a clustered environment for the cache default

      /subsystem=datagrid-infinispan/cache-container=clustered/distributed-cache=default:read-attribute(name=evictions)
    
  • in a single node environment for the cache default

      /subsystem=datagrid-infinispan/cache-container=local/local-cache=default:read-attribute(name=evictions)
    

Other possibility is to use the JMX MBean directly.

Product(s)
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.