Hi,

Answered you on stackoverflow:
https://stackoverflow.com/questions/53193997/does-a-ignite-cache-return-metrics-for-a-cache-in-local-mode/53453990#53453990

Evgenii

пн, 19 нояб. 2018 г. в 12:39, Paddy <[email protected]>:

> I posted this on Stack Overflow a while back, but this is probably a better
> place for the question. It seems like Ignite does not return the cache size
> metrics for a cache in local mode. The code I used to test this in Ignite
> 2.6 is:
>
>     IgniteConfiguration igniteConfig = new IgniteConfiguration();
>     CacheConfiguration cacheConfig = new CacheConfiguration("testCache");
>     cacheConfig.setStatisticsEnabled(true);
>     igniteConfig.setCacheConfiguration(cacheConfig);
>     cacheConfig.setCacheMode(CacheMode.LOCAL);
>
>     try (Ignite ignite = Ignition.start(igniteConfig)) {
>         IgniteCache cache = ignite.<String,
> String>getOrCreateCache(cacheConfig.getName());
>         cache.put("key", "val");
>         cache.put("key2", "val2");
>         cache.remove("key2");
>
>         System.out.println(cache.localMetrics());
>     }
>
> I get:
>
>     CacheMetricsSnapshot [reads=0, puts=2, hits=0, misses=0, txCommits=0,
> txRollbacks=0, evicts=0, removes=1, putAvgTimeNanos=8054.916,
> getAvgTimeNanos=0.0, rmvAvgTimeNanos=3732.072, commitAvgTimeNanos=0.0,
> rollbackAvgTimeNanos=0.0, cacheName=testCache, offHeapGets=0,
> offHeapPuts=0,
> offHeapRemoves=0, offHeapEvicts=0, offHeapHits=0, offHeapMisses=0,
> offHeapEntriesCnt=1, heapEntriesCnt=0, offHeapPrimaryEntriesCnt=1,
> offHeapBackupEntriesCnt=1, offHeapAllocatedSize=0, size=0, keySize=0,
> isEmpty=false, dhtEvictQueueCurrSize=-1, txThreadMapSize=0, txXidMapSize=0,
> txCommitQueueSize=0, txPrepareQueueSize=0, txStartVerCountsSize=0,
> txCommittedVersionsSize=0, txRolledbackVersionsSize=0,
> txDhtThreadMapSize=0,
> txDhtXidMapSize=-1, txDhtCommitQueueSize=0, txDhtPrepareQueueSize=0,
> txDhtStartVerCountsSize=0, txDhtCommittedVersionsSize=-1,
> txDhtRolledbackVersionsSize=-1, isWriteBehindEnabled=false,
> writeBehindFlushSize=-1, writeBehindFlushThreadCnt=-1,
> writeBehindFlushFreq=-1, writeBehindStoreBatchSize=-1,
> writeBehindTotalCriticalOverflowCnt=-1, writeBehindCriticalOverflowCnt=-1,
> writeBehindErrorRetryCnt=-1, writeBehindBufSize=-1, totalPartitionsCnt=0,
> rebalancingPartitionsCnt=0, keysToRebalanceLeft=0, rebalancingKeysRate=0,
> rebalancingBytesRate=0, rebalanceStartTime=-1, rebalanceFinishTime=-1,
> rebalanceClearingPartitionsLeft=0, keyType=java.lang.Object,
> valType=java.lang.Object, isStoreByVal=true, isStatisticsEnabled=true,
> isManagementEnabled=false, isReadThrough=false, isWriteThrough=false,
> isValidForReading=true, isValidForWriting=true]
>
> Which shows that, put & remove metrics seem to be working, but size is 0.
> I've tried both cache.metrics().getSize() and
> cache.localMetrics().getSize()
> but they seem to give the same result. If I change the cache mode to
> REPLICATED or PARTITIONED then the cache size is correct.
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Reply via email to