Biren, Apparently, this cache metric is broken. It only shows number of records, that are locally stored. Here is the ticket for it: IGNITE-6564 <https://issues.apache.org/jira/browse/IGNITE-6564>
For now you can use IgniteCache#size() method instead. It's much less optimal, but shows correct values. Denis чт, 23 нояб. 2017 г. в 1:49, Biren Shah <[email protected]>: > Hi Denis, > > > > We are using CacheMetrics.getKeySize api to get size of a cache. Does this > api give cache size of entire cache or just the size of the partitions > local to the node? > > > > -Biren > > > > *From: *Denis Mekhanikov <[email protected]> > *Reply-To: *"[email protected]" <[email protected]> > *Date: *Wednesday, November 22, 2017 at 8:13 AM > *To: *"[email protected]" <[email protected]> > *Subject: *Re: Cache size changes unexpectedly > > > > Hi Brien! > > > > I tried to run a cluster with a cache configured like you described, but > everything works fine. > > Could you provide more information about this issue? A project with a > reproducer will be ideal. > > Are you sure that you measure size correctly? > > > > Denis > > > > ср, 22 нояб. 2017 г. в 1:28, Biren Shah <[email protected]>: > > Hi, > > > > We have a cluster of 4 nodes. On start of the cluster we load our caches. > In of our cache we are load around 2 million entries. We also monitor cache > size at regular interval. The behavior we are noticing is that after > initial load the cache size seems to be correct for few mins. But then the > size changes and it indicates that there are only 1 million entries in the > cache. Meaning initially cache size is ~2 million and within few minutes it > changes to ~1 million. We are deleting anything from the cache. Do entries > get off loaded to off-heap? > > > > Cluster node are setup to have 8GB memory and 8 cores. > > > > Configuration for the cache in question is: > > > > CacheConfiguration<String, Entry> cacheConfig = new CacheConfiguration<>(); > > cacheConfig.setOnheapCacheEnabled(true); > > cacheConfig.setCacheMode(CacheMode.PARTITIONED); > > cacheConfig.setBackups(1); > > cacheConfig.setCopyOnRead(false); > > > cacheConfig.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); > > cacheConfig.setStatisticsEnabled(true); > > > > -Biren > >
