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?
Cache stats for a particular server node can be acquired with IgniteCache.metrics(ClusterGroup grp) method, like this:
IgniteCache.metrics(ClusterGroup grp)
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:
statisticsEnabled
CacheConfiguration
true
cacheCfg.setStatisticsEnabled(true);
Hope this helps.
Cache stats for a particular server node can be acquired with
IgniteCache.metrics(ClusterGroup grp)
method, like this: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 onCacheConfiguration
totrue
:Hope this helps.