[ 
https://issues.apache.org/jira/browse/COCOON-2151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545767
 ] 

Ard Schrijvers commented on COCOON-2151:
----------------------------------------

"Only if you're generating lots of unique pages or short-lived pages and 
caching them for a long time may it become a 'real' problem"

Sorry, one more add on this line: It is actually vice versa: when you cache for 
a short period of time, you'll run into a 'real' problem much faster: Every 
time a page is evicted from the cache by its TTL (time to live) or LRU/MRU 
(you'll have faster OOM when you have a small possible number of cache entries) 
 and it is reloaded,  an extra cachekey and event is added to the double maps! 

So, the smaller your TTL, the faster you'll run into OOM....sounds  as a 
contradiction I admit :-)

ps if you are suffering from OOM because of growing registry (set TTL low, and 
crawl you site several times and use some profiler to see memory) and you don't 
want the hassle of WeakReferences with JCSCache (it will take you a few weeks) 
you can have a lightweight improvement which would delay the OOM pretty much:

Instead of storing in the doublemaps the events as string, you can easily use 
the hashcode of the events. This reduces memory consumption pretty much 
already. In the absolute rare cases that two hashcodes coincide, all that 
happens is a 'not necessary' removal from a cachekey. 

Furthermore, You might hook in something that is similar to the StoreJanitor 
for the event registry: ie, every 10 or 60 seconds, check their maps, and if 
something is found like 

["key1",  {"value1", "value1", "value2", "value1", "value2"}  ] replace it by 

["key1" , {"value1", {"value2"}]

I did something similar on putting a key in, because I had a growing multimap 
with WeakReferences(null) after the cachekeys where removed.

Anyway, think there is a lightweight solution possible which works pretty 
well....but i still don't like it :-)

> Sub-optimal implementation of AbstractDoubleMapEventRegistry
> ------------------------------------------------------------
>
>                 Key: COCOON-2151
>                 URL: https://issues.apache.org/jira/browse/COCOON-2151
>             Project: Cocoon
>          Issue Type: Improvement
>          Components: Blocks: Event Cache
>    Affects Versions: 2.1.10, 2.2-dev (Current SVN)
>            Reporter: Jörg Heinicke
>
> This is just a follow-up from COCOON-2146 where Ard pointed out some issues 
> with AbstractDoubleMapEventRegistry. I just didn't want to lose the 
> information when I actually fixed the issue. So I will add it here.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to