I am using Guava cache in one of my library and that library is being used by some other service (managed by other team) in my company. From my library I am logging cache stats
every 50000
times. Below is the the output I see whenever it is getting logged
Cache Stats= CacheStats{hitCount=3296628, missCount=1353372, loadSuccessCount=1353138, loadExceptionCount=0, totalLoadTime=2268064327604, evictionCount=1325410}
Cache Stats= CacheStats{hitCount=3334167, missCount=1365834, loadSuccessCount=1365597, loadExceptionCount=0, totalLoadTime=2287551024797, evictionCount=1337740}
Cache Stats= CacheStats{hitCount=3371463, missCount=1378536, loadSuccessCount=1378296, loadExceptionCount=0, totalLoadTime=2309012047459, evictionCount=1350990}
Cache Stats= CacheStats{hitCount=3407719, missCount=1392280, loadSuccessCount=1392039, loadExceptionCount=0, totalLoadTime=2331355983194, evictionCount=1364535}
Cache Stats= CacheStats{hitCount=3443848, missCount=1406152, loadSuccessCount=1405908, loadExceptionCount=0, totalLoadTime=2354162371299, evictionCount=1378654}
And my cache configuration is as shown below:
CacheBuilder
.newBuilder()
.maximumSize(1000000)
.expireAfterWrite(120, TimeUnit.SECONDS)
.concurrencyLevel(5000)
.removalListener(
RemovalListeners.asynchronous(new CustomListener(),
Executors.newSingleThreadScheduledExecutor())).build();
Can anyone help me understand what is the hit ratio we have and how to interpret above cache metrics? I am confuse what does those numbers tells me. Basis on above results can we see better performance if we bump up maximumSize
or expireAfterWrite
interval?
Note: we are still using guava-11.0.2 and I cannot bump up for some reason.