[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cache



Hi Estani:

yes we are caching catalogs, and we know its inefficient. we have been trying to refactor this for a while.

meanwhile, for servers with many static catalogs, you should turn off caching:

http://www.unidata.ucar.edu/projects/THREDDS/tech/tds4.2/reference/ThreddsConfigXMLFile.html#CatalogCaching

good to see you in livermore, hope to run into you soon!

john

On 12/8/2011 6:56 AM, Estanislao Gonzalez wrote:
Hi John,

I haven't got the time to test the new TDS, although I'm eager to :-)

But debugging some other problems (and playing around with new tools from the JDK 1.6) I got this dump of a working TDS:
Object Histogram:

num       #instances    #bytes  Class description
--------------------------------------------------------------------------
1:              16076618    1062825760      char[]
2:              9141380     524291112       java.lang.Object[]
3:              13688352    438027264       java.lang.String
4:              8749808 209995392       java.util.ArrayList
5:              5077955 162494560       org.jdom.Attribute
6: 2093916 150761952 org.apache.xerces.impl.xs.opti.ElementImpl 7: 3009594 120383760 org.apache.xerces.impl.xs.opti.AttrImpl
8:              2917424 116696960       org.jdom.Element
9:              4277339 102656136       org.jdom.Text
10:             2430493 97219720        org.jdom.Attribute[]
11:             2920707 93462624        org.jdom.ContentList
12:             2917424 93357568        org.jdom.AttributeList
13:             69695   93236992        byte[]
14:             1390423 85737680        int[]
15:             1366453 74250648        org.jdom.Content[]
16:             560070  53766720        thredds.catalog.ThreddsMetadata
17:             2084070 50306496        org.w3c.dom.Attr[]
...

What is being cached exactly? It looks a lot...
Why are the DOM there?

I think that you might be holding the DOM elements in a strong reference, and those, again, are the one holding the String and, again, the char[]. Do you need to store the DOM? Is this changing dynamically so often for your other use-cases? I would have thought you would want to create the DOM, dump it to a string and hold that string within a SoftReference object to allow GC in case it's needed. The DOM could then GC and would be eligible over the SoftReference (supposedly)

How are you caching the catalogs exactly?

Thanks,
Estani