How to output gridgain/ignite statistics to a file

805 views Asked by At

How can i capture operation statistics such as puts/sec, gets/sec per server from ignite/gridgain.

Is it possible to output them into some file so that we can analyze them later?

1

There are 1 answers

1
Valentin Kulichenko On BEST ANSWER

Cache stats for a particular server node can be acquired with IgniteCache.metrics(ClusterGroup grp) method, like this:

ClusterGroup grp = ignite.cluster().forNodeId(SERVER_NODE_ID);

CacheMetrics metrics = cache.metrics(grp);

long puts = metrics.getCachePuts();
long gets = metrics.getCacheGets();

You can periodically get them, calculate throughput values for this period of time (you will have to save the previous snapshot) and log to a file.

Note that metrics are disabled by default for performance reasons. To enable them set statisticsEnabled flag on CacheConfiguration to true:

cacheCfg.setStatisticsEnabled(true);

Hope this helps.