For the complete documentation index, see llms.txt. This page is also available as Markdown.

Configuring Metrics

How to enable or disable GridGain metrics — cache, data region, persistence, and index operation metrics — through configuration, JMX beans, or system properties.

Metrics can provide information about cluster performance and potential issues. As such, metrics are enabled by default.

Metric collection is not a free operation, so you may want to disable some metrics for additional performance.

Disabling Cache Metrics

Cache metrics show statistics on the amount of data stored in caches, the total number and frequency of cache operations, etc. as well as some cache configuration properties for information purposes.

You can disable cache metrics to save on performance expenses for gathering them. To do this, use one of the methods described below for each cache you want to monitor.

<property name="cacheConfiguration">
    <list>
        <bean class="org.apache.ignite.configuration.CacheConfiguration">
            <property name="name" value="mycache"/>
            <!-- Disable statistics for the cache. -->
            <property name="statisticsEnabled" value="false"/>
        </bean>
    </list>
</property>
IgniteConfiguration cfg = new IgniteConfiguration();

CacheConfiguration cacheCfg = new CacheConfiguration("test-cache");

// Enable statistics for the cache.
cacheCfg.setStatisticsEnabled(true);

cfg.setCacheConfiguration(cacheCfg);

// Start the node.
Ignite ignite = Ignition.start(cfg);
var cfg = new IgniteConfiguration
{
    CacheConfiguration = new[]
    {
        new CacheConfiguration("my-cache")
        {
            EnableStatistics = false
        }
    }
};

var ignite = Ignition.Start(cfg);

unsupported

Enabling Cache Metrics at Runtime

You can turn cache metrics on and off in a running cluster dynamically. The change takes effect immediately and does not require a restart.

Use the IgniteCache.enableStatistics() method:

unsupported

You can also change several caches in a single call by using IgniteCluster.enableStatistics():

unsupported

The new value is also saved to the cache configuration. For a cache in a data region with persistence enabled, the setting survives a cluster restart.

Reading Cache Metrics

To read the latest metrics snapshot of a specific cache, use one of the IgniteCache methods:

  • IgniteCache.metrics() — gets the metrics snapshot of the whole cluster where the cache is deployed.

  • IgniteCache.metrics(ClusterGroup grp) — gets the metrics snapshot for the nodes that belong to the given cluster group.

  • IgniteCache.localMetrics() — gets the local node's metrics snapshot for the cache.

To calculate the size of a cache, see Memory Usage Calculation.

JMX Beans

For each cache on a node, GridGain creates two JMX Beans: one with cache information specific to the node, and one with global (cluster-wide) information about the cache.

Local cache information MBean:

Global cache information MBean:

The more common and useful beans and metrics are:

  • CacheMetricsMXBean:

    • CacheGets (total number of requests to the cache)

    • AverageGetTime (mean time to execute gets)

    • AverageTxCommitTime (mean time to execute a transaction commit)

  • CacheGroupMetricsMXBean:

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

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 enableStatistics() and disableStatistics() methods exposed by the bean to start and stop collecting cache metrics, and clear() to reset the counters.

For a complete list of metrics available, refer to the CacheMetricsMXBean javadoc.

Disabling Data Region Metrics

Data region metrics expose information about data regions, including memory and storage size of the region. Disable data region metrics for every region you do not need the metrics for.

Data region metrics can be disabled in two ways:

The following example illustrates how to enable metrics for the default data region and one custom data region.

unsupported

Data region metrics can be enabled/disabled at runtime via the following JMX Bean:

Data Region MBean

Persistence-related metrics can be enabled/disabled in the data storage configuration:

unsupported

You can enable or disable "Persistent Store" metrics at runtime via the following MXBean:

Persistent Store MBean

Operation
Description

EnableMetrics

Enable persistent data storage metrics.

Configuring Maximum-Value Metrics

Some metrics, such as communication.tcp.maxOutboundMessagesQueueSize and io.discovery.MaxMsgQueueSize, report the maximum value observed over a time interval. The default interval is 60 seconds.

To change the interval, call the configureMaxValueMetric(name, timeInterval) operation of the MetricsMxBean MBean, where name is the full metric name and timeInterval is the new interval in milliseconds. The value must be positive. The change applies to all nodes in the cluster.

Disabling Index Operation Metrics

GridGain collects index operation metrics for every SQL secondary index. Because these metrics time individual B+tree page operations, they add overhead to index reads and writes.

The metrics are collected only for caches that have statistics enabled, so disabling statistics for a cache also stops them. To switch the metrics off for all indexes on a node, regardless of the cache statistics setting, start the node with the IGNITE_BPLUS_TREE_DISABLE_METRICS system property set to true:

The default value is false. The property is read when an index tree is created, so set it before you start the node. See Setting JVM Options to learn about different ways to set system properties.

This page is: Copyright © 2026 MariaDB. All rights reserved.

spinner

Last updated

Was this helpful?