3

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?

Steve Lillis
  • 3,263
  • 5
  • 22
  • 41

1 Answers1

4

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.

Valentin Kulichenko
  • 8,365
  • 1
  • 16
  • 12
  • I have a few questions about ignite metrics - 1. I have enabled cache metrics but I still see the cache puts as 0 for remote nodes (cache.metrics(ignite.cluster().forRemotes().getCachePuts()) while I have inserted 10k records in the cache. The local metric count is 210. What could be the reason? 2. How do I get the count of cache entries on each of the nodes in the cluster? – Andy Dufresne Jun 01 '16 at 09:56