I have the ehcache configuration that stores items offheap for 4G size. I do see a lot of items start to evict at around 100000 items in the cache even though cache occupied size is around 2.9G (out of 4G allocated). The constant stream of evictions at > 200 items per sec drops my hit rate to 65%.
Any idea what could be the cause of these evictions ? Is the off-heap store also limited by size or percentage of the allocated direct memory on the JVM. These are not expired items but evicted items for some reason.
CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
.using(statisticsService)
.withCache("cache", CacheConfigurationBuilder.newCacheConfigurationBuilder(String.class, String.class, ResourcePoolsBuilder.newResourcePoolsBuilder()
.offheap(4, MemoryUnit.GB).build())
.withExpiry(ExpiryPolicyBuilder.timeToIdleExpiration(Duration.ofMinutes(10)))
.withExpiry(ExpiryPolicyBuilder.timeToLiveExpiration(Duration.ofMinutes(10)))
.withService(WriteBehindConfigurationBuilder.newUnBatchedWriteBehindConfiguration().queueSize(10).concurrencyLevel(10).build())
)
.build()