Mailing List
Home
Forum Home
Maven - Project building tool
Axis - Java SOAP implementation
Lucene - Full-featured text search engine APIs
Cocoon - MVC web framework based on XML/XSL
Fop - Create PDF, PCL, PS, SVG, XML driven by XSL formatting objects.
Log4J - A log library
POI - Java Excel, Word and other Microsoft Office files manipulating library
Oracle database error code ...
Subjects
log4j warning: No appenders could be found
java security AccessControlException: access denied (java io FilePermission clie
java lang InstantiationException: org apache tools ant Main
Apache Axis Tutorial
Struts <logic iterate >
log4j properties How to parse outpu to multiple files
configuring log4j with BEA Weblogic 8 1
How to use XSL FOP Java together
JSP precompile
Servlet File Download dialog problem (IE6,Adobe 6 0)
Proposal: Adding jar manifest classpath in jar and war plugins
Unsupported major minor version 48 0 problem while running the an
   telope task
java security AccessControlException: access denied (java io FilePermission
axis wsdl2java Ant Task usage
net sf hibernate MappingException: Error reading resource: test/User hbm xml
Building EAR ANT Script for websphere 5 0
CREATING WAR Files
jsp data into Excel
Classpath problem
Jboss 3 2 3+ vs Tomcat Axis Question
RE: How to include jars and add them into the MANIFEST MF/Class Path
attribute
Printing problem
InstantiationException
Couldn 't find trusted certificate
Please : How can one install ant 1 6 0 under Eclipse 2 1 ?
Excel: Too many different cell formats
Running junit tests fails
XDoclet, Struts and Maven: Where to start? SOLUTION
1 3 final: now giving me java io FileNotFoundException (Too many
open files)
AXIS: tomcat timeout ?
 
cocoon-ehcache-1.data becomes very large

cocoon-ehcache-1.data becomes very large

2006-07-13       - By Ard Schrijvers

 Back
Reply:     1     2     3     4     5     6     7     8  


> On 7/13/06, Andreas Hartmann <andreas@(protected)> wrote:
>
> > ...<parameter name="overflow-to-disk" value="false"/>
> >
> > Is there a special reason why this is set to "false"?...
>
> It's because in that case we only want a short-term cache. There are
> more parameters which might help, they are read by the
> src/java/org/apache/cocoon/components/store/impl/EHDefaultStore.java
> class IIUC.

Beside the fact that I am (have to begin but is on my agenda) going to write a
best practice on these kind of things, I will try some to explain some stuff
here in short:

First of all, make sure you have the EHDefaultStore.java from the trunk. This
one has some important patches.

Now, a common configuration for your store would be:

<store logger="core.store">
   <parameter name="maxobjects" value="1000"/>
   <parameter name="eternal" value="false"/>
   <parameter name="timeToLiveSeconds" value="0"/>
   <!-- 1 day -->
   <parameter name="timeToIdleSeconds" value="86400"/>
   <parameter name="overflow-to-disk" value="true"/>
   <parameter name="diskpersistent" value="true"/>
</store>

This means, a maximum of 1000 object (keys+response) are kept in memory. Since
eternal is false, timeToLiveSeconds and timeToIdleSeconds are taken into
account. Is timeToLiveSeconds < timeToIdleSeconds, then only timeToIdleSeconds
matters. In the configuration above, after 1 day of not being used, the
cachekey is removed from cache.

So, when overflow-to-disk is set to true, and you don't have eternal false and
timeToIdleSeconds > 0, then ones a cachekey is in memory/disk, it will never be
removed (apart from the StoreJanitor which when low on memory lets the
EHDefaultStore free its cache ---though this couldn't be implemented worse
because it just starts removing cachekeys/reponses from index 0 (which are
commonly the most important ones) instead of removing them according the
correct eviction policy. I have posted already to the ehcache mailinglist how
to find the LRU one, but not yet got an answer--- and I assume you dont use
eventAware cache actively removing keys )

So, it is very well possible, to let your cache grow INFINITELY large. Setting
timeToIdleSeconds is important. Certainly when for example you have cachekeys
including current date (though, watch out with these kind of cache practices
because your cache could grow very large)

diskpersistent is added to be configurable since short, but does not really
matter. It only indicates persistent cache between JVM restarts (used to be
default true).

If you are working with a cocoon versions < 2.1.9, and you dont want to switch,
but want to use the latest EHDefaultStore, just add the EHDefaultStore.java
from trunk in your src/java/country/yourcomapany/cocoon..., and add to user
.roles:

<role name="org.apache.excalibur.store.Store Source code of org.apache.excalibur.store.Store"
       shorthand="store"
       default-class="country.yourcompany.cocoon.components.store.impl
.EHDefaultStore"
 />

Now, just check it out configuring timeToIdleSeconds to 5 secs or something.
Then look at the StatusGenerator, and you will see cachekeys being dumped after
5 sec (by the way, dont refresh the StatusGenerator to often then, because
looking at the StatusGenerator uses the keys, implying they are not idle for
another 5 sec... :-) )

Hope things are little clearer...

Regards Ard

>
> -Bertrand
>
> -- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
> To unsubscribe, e-mail: users-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>
>

-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ------
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)