If I'm reading the ehcacheConfig.xml file correctly, the cached entries don't expire after a given time. Instead, the cache has a max element size of 1000 and once that limit is reached the least recently used elements will be expelled from the cache.
And to give closure to the problem I initially posted, the number of RuleSets I was seeing was normal for the CSS files that were being loaded. A potential problem I see with the default cache configuration is that the cache will grow to 1000 elements. In the case of the parsedCss cache those elements are CssTree$StyleSheet elements. So that's 1000 style sheets that are loaded and if those style sheets are sufficiently large they will eat a lot of memory in the in memory cache. Is there a recommended way to deal with this? I've noticed that EhCache 2.5 has some nice config around maximum bytes on the local heap, off the heap, and on disk. That seems like a better way to configure these potentially large caches. Thanks, -Stanton From: Ryan J Baxter/Westford/IBM@Lotus To: dev@shindig.apache.org, Date: 10/19/2011 20:02 Subject: Re: Memory concerns: what is the "normal" amount of CssTree.RuleSet objects to see at runtime Jas does the cached entries expire at some point? I assume this would be another configuration option... -Ryan Email: rjbax...@us.ibm.com Phone: 978-899-3041 developerWorks Profile From: ๏̯͡๏ Jasvir Nagra <jas...@google.com> To: dev@shindig.apache.org, Date: 10/19/2011 07:40 PM Subject: Re: Memory concerns: what is the "normal" amount of CssTree.RuleSet objects to see at runtime A css rule-set is what just a css selector (or more accurately, one or more css selectors) and a block of css declarations. Eg: div { background-color: red; color: pink; } is a rule-set. It depends on what you're parsing - typically, a stylesheet, webpage or gadget will have tens of rules and if you're caching across multiple such pages, this number can grow quickly. Presumably, you'd adjust the EhCache capacity if these objects were overwhelming the cache. On Wed, Oct 19, 2011 at 12:53 PM, Stanton Sievers <ssiev...@us.ibm.com>wrote: > Thanks Jas. > > The parsed css cache is the one I was referring to. EhCache is the cache > provider in this case, so that's probably why I was seeing EhCache > references to the Caja objects in the Eclipse MAT. > > I'll disable it and see what I can find. In the meantime, would 1700 of > these RuleSets seem reasonable for a Shindig server? Or is there no way > to tell? ~1700 just seems like a lot, but I'm in no way an expert on what > those RuleSets are used for. :) > > Thanks, > -Stanton > > > > From: ๏̯͡๏ Jasvir Nagra <jas...@google.com> > To: dev@shindig.apache.org, > Date: 10/19/2011 15:06 > Subject: Re: Memory concerns: what is the "normal" amount of > CssTree.RuleSet objects to see at runtime > > > > And he hangs out here. :) > > As you'd expect, CssTree.RuleSets (and all the other parse tree nodes) are > retained as long as the root of the parse tree is retained. Nothing in > the > Caja parser retains a reference to the root of the parse tree after the > parse. In > Shindig, > > shindig/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssParser.java > has a parsed css cache - is that the cache you're referring to? > > A quick check to test this would be to turn that off that cache and see if > you still see a lot of CssTree.Rulesets retained. > > jas > > > On Wed, Oct 19, 2011 at 11:48 AM, Ryan J Baxter <rjbax...@us.ibm.com> > wrote: > > > You want to ask Jasvir, he is the Caja lead at Google :) > > > > -Ryan > > > > Email: rjbax...@us.ibm.com > > Phone: 978-899-3041 > > developerWorks Profile > > > > > > > > From: Stanton Sievers/Westford/IBM@Lotus > > To: dev@shindig.apache.org, > > Date: 10/19/2011 02:21 PM > > Subject: Memory concerns: what is the "normal" amount of > > CssTree.RuleSet objects to see at runtime > > > > > > > > Hi everyone, > > > > I'm seeing a lot of com.google.caja.parser.css.CssTree$RuleSet objects > > when running Shindig. I'm seeing around 1700 of these RuleSet objects > > being retained, which equates to between 9MB and 10MB. This constitutes > > ~15% of the total heap size! These RuleSets appear to be in an > ArrayList > > that is referenced by com.google.caja.parser.ChildNodes (at least > > according to Eclipse Memory Analyzer). > > > > Is this normal? Is it possible EhCache is hanging onto a bunch of these > > objects? > > > > I want to get everyone's opinion here before I post something to the > Caja > > folks. > > > > Thanks, > > -Stanton > > > > > > > > > > > > > >