cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ard Schrijvers" <a.schrijv...@hippo.nl>
Subject RE: Cache (persistence & performance)
Date Tue, 17 Apr 2007 11:28:59 GMT

> Thank you for your reply, Ard!
> 
> I don't know how to control the cache from cocoon.xconf. I use Cocoon 
> 2.1.7. The cache section in cocoon.xconf looks like this:
> 
>   <transient-store logger="core.store.transient">
>     <parameter name="maxobjects" value="1000"/>
>   </transient-store>
>  
>   <store logger="core.store">
>     <parameter name="maxobjects" value="1000"/>
>   </store>
> 
> I see two files being modified after some "action" using the webapp: 
> cocoon-ehcache-1.data & cocoon-ehcache-1.index. I asume
> that this is the persistent cache. 

It is a cache that uses disk. It is only diskpersistent when you configure it to be. The transient
store is a memory only store, because it has non serializable cached objects.

The second store is you configuration for the ehcache. You can add:

<parameter name="diskpersistent" value="true"/>

but it might be very well possible that this is added after cocoon 2.1.7 , so you would need
to update.

Chech the EHDefaultStore.java to see which parameters are allowed, or check the wiki (dont
know if is up2date) and look for "caching", "ehcache", "ard schrijvers" etc in 

http://marc.info/?l=xml-cocoon-users&r=1&w=2

i have posted many explanations on cocoon caching before,

Regards Ard

> Am I right? If so, why 
> doesn't Cocoon 
> use this cache after a webserver restart? I put System.out.println
> statements in my generators and they confirm that the content 
> is being 
> regenerated (content is cached correctly while the webserver 
> is running).
> It's like a transient cache is working correctly, but a 
> persistent cache 
> is not.
> 
> Where can I find the parameters that I can use with these 2 stores?
> As you said, I want cache that is persistent between JVM 
> restarts. Can I 
> get a step further and copy the persistent cache
> to another installation of my webapp (onto another webserver)?
> 
> I'm sure that I do not have all the information needed about this 
> matter. Can you please provide some good links ? I only
> found bits and pieces here and there all around the web 
> (weird sentence:).
> 
> Thanks a lot!
> 
> Dan
> 
> Ard Schrijvers wrote:
> > Hello Dan,
> >
> >   
> >> Hi!
> >>
> >> I have been trying for a few days now to find out where (and 
> >> if) Cocoon persists
> >> the cached XML chunks obtained from pipelines. Almost all of 
> >> the pipelines I've
> >> written implement CacheableProccessingComponent. 
> >>     
> >
> > You mean all your compoments in a pipeline implement 
> CacheableProccessingComponent. If one does not,
> > your cocoon caches untill the first not cacheable 
> transformer (if the generator does not cache,
> > nothing gets cached. Also, implementing 
> CacheableProccessingComponent is no garantuee for a proper working
> > cache of your component. The cachekey and validity object 
> do have to make sense! [1] )
> >
> >   
> >> I read 
> >> something about a
> >> <persistent-store> tag in cocoon.xconf, but I didn't 
> >> understand much. 
> >>     
> >
> > A persistent-store...just to be sure, means that you want a 
> cache that is persistent between JVM restarts, right? If you 
> are using EHCache, 
> > you can see in this code snippet where it stores the cached 
> responses (if you use EHCache):
> >
> > 	try {
> >             if 
> (parameters.getParameterAsBoolean("use-cache-directory", false)) {
> >                 if (this.getLogger().isDebugEnabled()) {
> >                     getLogger().debug("Using cache 
> directory: " + cacheDir);
> >                 }
> >                 setDirectory(cacheDir);
> >             }
> >             else if 
> (parameters.getParameterAsBoolean("use-work-directory", false)) {
> >                 if (this.getLogger().isDebugEnabled()) {
> >                     getLogger().debug("Using work 
> directory: " + workDir);
> >                 }
> >                 setDirectory(workDir);
> >             }
> >             else if (parameters.getParameter("directory", 
> null) != null) {
> >                 String dir = parameters.getParameter("directory");
> >                 dir = 
> IOUtils.getContextFilePath(workDir.getPath(), dir);
> >                 if (this.getLogger().isDebugEnabled()) {
> >                     getLogger().debug("Using directory: " + dir);
> >                 }
> >                 setDirectory(new File(dir));
> >             }
> >             else {
> >                 try {
> >                     // Legacy: use working directory by default
> >                     setDirectory(workDir);
> >                 } catch (IOException e) {
> >                 }
> >             }
> >         } catch (IOException e) {
> >             throw new ParameterException("Unable to set 
> directory", e);
> >         }
> >
> > in cocoon.xconf, you can set in the ehcache store 
> configuration, <parameter name="diskpersistent" value="true"/>
> >
> >
> >   
> >> Can you
> >> please tell me how, or at least where is Cocoon persisting 
> >> its cache and is
> >> there a way to redirect this persistence (say to a DB)?
> >>     
> >
> > To a DB....I would use a Cache which is capable of 
> persisting in a DB (JCS can, I suppose EHCache also)
> >
> >   
> >> And another thing... Can you please tell me what parameters 
> >> do I need to modify
> >> in order to temper with Cocoon's cache performance.
> >>     
> >
> > ?? what do you mean? Anyway, the cache parameters are in 
> cocoon.xconf in <store>. You can find this on the wiki
> >
> >   
> >> P.S. By Cocoon's cache, I understand cached versions of a XML 
> >> generated
> >> response. Is this correct? Maybe I got it all wrong...
> >>     
> >
> > Hmmm, more or less you could see it that way (though it is 
> more subtle, look at CachedResponse if you want to know 
> more...also look at your 
> > localhost:port/status page to see which cachekeys are created)
> >
> >   
> >> Many thanks!
> >>     
> >
> > Regards Ard
> >
> > [1] http://cocoon.zones.apache.org/daisy/cdocs/g1/g1/g7/690.html
> >
> >   
> >> Dan
> >>
> >> ----------------------------------------------------------------
> >> This message was sent using IMP, the Internet Messaging Program.
> >>
> >>
> >>
> >> 
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >> For additional commands, e-mail: users-help@cocoon.apache.org
> >>
> >>
> >>     
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> >
> >   
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message