Re: Local Query Cache Problems

Aristedes Maniatis <[email protected]>
Newsgroups gmane.comp.java.cayenne.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.