开发者

ehcache LRU evicting recently used entries

Using Ehcache , after Java app works 2.5 days, I have this statistic

cacheHits:  31185262, approximate 131 per sec
cacheMisses:    4642979, approximate 19  per sec
evictedCount:   4106931, approximate 17 per sec

and last hour it looks like

cacheHits:  60 per sec
cacheM开发者_开发百科isses:    57 per sec
evictedCount:   53 per sec

size of cache=400000, items never expire.

Why does it happen?


i guess i found the cause.

some time ago i upgraded ehcache from 1.6.xx to 1.7.xx. i didn't noticed that they changed implementation of evicting algorithm. now it works as follows: select random 15 keys(!, they use some heuristics, but nevertheless it is still random), then find corresponding elements, select last recently used element from selected ones. (you can figure out it by yourself after looking a MemoryStore class). after that not surprising that it works very very bad.

good news is that you can use old implementation by setting a property "net.sf.ehcache.use.classic.lru"=true. after i did that my problem disappeared


You might look at other Cache Eviction Algorithms. See also Cache replacement policies.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜