Configuring Metrics
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);
This API is not presently available for C++. You can use XML configuration.
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:
-
group=<Cache_Name>,name="org.apache.ignite.internal.processors.cache.CacheLocalMetricsMXBeanImpl"
- Global cache information MBean:
-
group=<Cache_Name>,name="org.apache.ignite.internal.processors.cache.CacheClusterMetricsMXBeanImpl"
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:
-
in the configuration of the region
-
via JMX Beans
The following example illustrates how to enable metrics for the default data region and one custom data region.
<bean class="org.apache.ignite.configuration.IgniteConfiguration" id="ignite.cfg">
<property name="dataStorageConfiguration">
<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
<property name="defaultDataRegionConfiguration">
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<!-- disable mertrics for the default data region -->
<property name="metricsEnabled" value="false"/>
<!-- other properties -->
</bean>
</property>
<property name="dataRegionConfigurations">
<list>
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<!-- Custom region name. -->
<property name="name" value="myDataRegion"/>
<!-- Disable metrics for this data region -->
<property name="metricsEnabled" value="false"/>
<property name="persistenceEnabled" value="true"/>
<!-- other properties -->
</bean>
</list>
</property>
</bean>
</property>
</bean>
IgniteConfiguration cfg = new IgniteConfiguration();
DataStorageConfiguration storageCfg = new DataStorageConfiguration();
DataRegionConfiguration defaultRegion = new DataRegionConfiguration();
defaultRegion.setMetricsEnabled(false);
storageCfg.setDefaultDataRegionConfiguration(defaultRegion);
// Create a new data region.
DataRegionConfiguration regionCfg = new DataRegionConfiguration();
// Region name.
regionCfg.setName("myDataRegion");
// Disable metrics for this region.
regionCfg.setMetricsEnabled(false);
// Set the data region configuration.
storageCfg.setDataRegionConfigurations(regionCfg);
// Other properties
// Apply the new configuration.
cfg.setDataStorageConfiguration(storageCfg);
Ignite ignite = Ignition.start(cfg);
var cfg = new IgniteConfiguration
{
DataStorageConfiguration = new DataStorageConfiguration
{
DefaultDataRegionConfiguration = new DataRegionConfiguration
{
Name = DataStorageConfiguration.DefaultDataRegionName,
MetricsEnabled = false
},
DataRegionConfigurations = new[]
{
new DataRegionConfiguration
{
Name = "myDataRegion",
MetricsEnabled = false
}
}
}
};
var ignite = Ignition.Start(cfg);
This API is not presently available for C++. You can use XML configuration.
Data region metrics can be enabled/disabled at runtime via the following JMX Bean:
- Data Region MBean
-
org.apache:group=DataRegionMetrics,name=<Data Region Name>
Disabling Persistence-related Metrics
Persistence-related metrics can be enabled/disabled in the data storage configuration:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<bean class="org.apache.ignite.configuration.IgniteConfiguration" id="ignite.cfg">
<property name="dataStorageConfiguration">
<bean class="org.apache.ignite.configuration.DataStorageConfiguration">
<!-- persistent storage metrics -->
<property name="metricsEnabled" value="true"/>
<property name="defaultDataRegionConfiguration">
<bean class="org.apache.ignite.configuration.DataRegionConfiguration">
<property name="persistenceEnabled" value="true"/>
<!-- enable mertrics for the default data region -->
<!--property name="metricsEnabled" value="true"/-->
<!-- other properties -->
</bean>
</property>
</bean>
</property>
</bean>
</beans>
IgniteConfiguration cfg = new IgniteConfiguration();
DataStorageConfiguration storageCfg = new DataStorageConfiguration();
storageCfg.setMetricsEnabled(false);
// Apply the new configuration.
cfg.setDataStorageConfiguration(storageCfg);
Ignite ignite = Ignition.start(cfg);
var cfg = new IgniteConfiguration
{
DataStorageConfiguration = new DataStorageConfiguration
{
MetricsEnabled = false
}
};
var ignite = Ignition.Start(cfg);
This API is not presently available for C++. You can use XML configuration.
You can enable or disable "Persistent Store" metrics at runtime via the following MXBean:
- Persistent Store MBean
-
org.apache:group="Persistent Store",name=DataStorageMetrics
Operation Description EnableMetrics
Enable persistent data storage metrics.
© 2024 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.