Yeah, LRU caches are prone to individual cache entry size fluctuations. With large active caches this averages out (more or less), but is still an issue.
Somehow I overlooked Caffeine. Looks interesting. Let me try to switch a few projects. Andrus > On Apr 12, 2018, at 6:45 AM, Aristedes Maniatis <[email protected]> wrote: > > On 11/4/18 11:28pm, Andrus Adamchik wrote: >> Also EhCache may actively remove expired items (?), but OSCache certainly >> did not, and it was not a problem either, also because of maxsize/LRU. > > Actually that's a problem in EHcache that had us leave it and use Caffeine > instead. EHCache only tries to clean up memory when you write a new item to > the cache and it is hardcoded to try and evict two items for every new item > you add. > > This is a real problem if you try to add a new 100Mb query result and it > happens to try to evict two 1kB queries already in the cache. Boom, your app > runs out of memory and dies. The response from the EHCache people was that it > works best when all items our roughly the same size. Unfortunately the > Cayenne query cache can easily add items with hugely different sizes. > > > We found that caffeine gives us a little more control over this process ( > https://github.com/ben-manes/caffeine/wiki/Cleanup ) and it is still a > trivial replacement since it implements jCache. > > Caching is definitely not one of those "click this box to make everything > faster" and forget about it things. > > > > > Oh, hi everyone. I know I've been absent for a while... my life has been a > little crazy. > > > Ari
