Monitoring Caches
GridGain has a set of metrics for caches (caches are the basic unit of GridGain applications).
Cache Beans and Metrics
The more common and useful beans and metrics are:
-
-
CacheGets (total number of requests to the cache)
-
AverageGetTime (mean time to execute gets)
-
AverageTxCommitTime (mean time to execute a transaction commit)
-
etc.
-
-
-
LocalNodeMovingPartitionsCount (count of partitions where state = MOVING for this cache group located on this node)
-
ClusterMovingPartitionsCount (count of partitions where state = MOVING for this cache group in the entire cluster)
-
ClusterOwningPartitionsCount (count of partitions where state = OWNING for this cache group in the entire cluster)
-
etc.
-
Enabling Cache Metrics
<bean class="org.apache.ignite.configuration.IgniteConfiguration">
<property name="cacheConfiguration">
<list>
<bean class="org.apache.ignite.configuration.CacheConfiguration">
<property name="name" value="test-cache"/>
<!-- Enable statistics for the cache. -->
<property name="statisticsEnabled" value="true"/>
</bean>
</list>
</property>
</bean>
IgniteConfiguration cfg = new IgniteConfiguration();
CacheConfiguration cacheCfg = new CacheConfiguration("test-cache");
// Enable statistics for the cache.
cacheCfg.setStatisticsEnabled(true);
// Start the node.
Ignition.start(cfg);
Using JMX Bean
You can access cache metrics via the CacheMetricsMXBean
interface. You can connect to the bean from any JMX-compliant tool or API. If you need to work with the bean from your application, use IgniteCache.mxBean()
or IgniteCache.localMxBean()
to get a bean reference.
Use the CacheMetricsMXBean.enableStatistics()
method exposed by a special JMX bean to activate collecting cache metrics.
For a complete list of metrics available, refer to the CacheMetricsMXBean javadoc.
Using Java
There are several ways to get the latest metrics snapshot of a specific cache:
-
IgniteCache.metrics()
- gets the metrics snapshot of the whole cluster where the cache is deployed. -
IgniteCache.metrics(ClusterGroup grp)
- gets the metrics snapshot for Apache Ignite nodes that belong to the given cluster group. -
IgniteCache.localMetrics()
- gets the local node’s metrics snapshot for the cache.
IgniteCache<Integer, Person> cache = ignite.getOrCreateCache("myCache");
// Get cache metrics
CacheMetrics cm = cache.metrics();
System.out.println("Avg put time: " + cm.getAveragePutTime());
System.out.println("Avg get time: " + cm.getAverageGetTime());
For a complete list of metrics available, refer to CacheMetrics javadoc.
Cache Size Calculation
To learn how to calculate cache size, see Memory Usage Calculation.
© 2025 GridGain Systems, Inc. All Rights Reserved. Privacy Policy | Legal Notices. GridGain® is a registered trademark of GridGain Systems, Inc.
Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are either registered trademarks or trademarks of The Apache Software Foundation.