You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Julian <ce...@yahoo.com> on 2003/05/20 23:55:43 UTC

Caching and Generator Concurrency

Hi,

<SCENARIO>
I want to generate an html view of various xml nodes
stored on the  filesystem.  The view may be requested
once a month or as little as once a year.  The system
has a few thousand users each with various html views.
</SCENARIO>

<QUESTIONS>
1. Can Cocoon use the cached html view rather than
generating a new html document over long periods of
time and multiple reboots?  

2. Can Cocoon's caching algorithm be configured to
determine if any of my xml nodes has changed since the
last html view generation?
</QUESTIONS>

Thanks in Advance,
Julian

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

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


RE: Caching and Generator Concurrency

Posted by Julian <ce...@yahoo.com>.
Geoff and Bertrand,

Thanks, you guys are beyond helpful!  

Based on your pointers, I am wondering the following:

<SCENARIO>
Suppose some of my xml data comes from the filesystem
and the rest from a relational database. Using Cocoon
2.1.
</SCENARIO>

<QUESTIONS>
1. How can Cocoon determine whether or not to send the
cached response based on only one validity object
(i.e. the file generator) rather than the results of
that pipeline (i.e. the xml file generator + the xsl
transformer + the html serializer)?

2. From the xsp cacheable examples
(http://localhost:8080/cocoon/samples/xsp/cacheable),
how are the validity objects used that the xsp page
creates in the <xsp:logic> section?
</QUESTIONS>

Thanks So Much,
Julian

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

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


RE: Caching and Generator Concurrency

Posted by Geoff Howard <co...@leverageweb.com>.
Oh, and depending on your servlet container, you may 
want to be sure to configure your cache directory 
to be outside it's work directory, as this may get 
deleted on restart (and obviously avoid /tmp)

Geoff

> -----Original Message-----
> From: Geoff Howard [mailto:cocoon@leverageweb.com]
> Sent: Tuesday, May 20, 2003 7:56 PM
> To: cocoon-users@xml.apache.org
> Subject: RE: Caching and Generator Concurrency
> 
> 
> > -----Original Message-----
> > From: Julian [mailto:cerebro70@yahoo.com]
> ...
> > <SCENARIO>
> > I want to generate an html view of various xml nodes
> > stored on the  filesystem.  The view may be requested
> > once a month or as little as once a year.  The system
> > has a few thousand users each with various html views.
> > </SCENARIO>
> > 
> > <QUESTIONS>
> > 1. Can Cocoon use the cached html view rather than
> > generating a new html document over long periods of
> > time and multiple reboots?  
> 
> Yes, in fact it will do this by default.  Depending on 
> how you are assembling your view, you will need to take 
> different steps to ensure cachability.  (also specific 
> steps and options depend on which version of Cocoon).
> 
> Cocoon has two levels of caching - an in memory cache 
> with configurable size limits and other options (see 
> cocoon.xconf).  By default out of the box, this is con-
> figured with a backup on-disk cache where the in-memory 
> objects go when the are ejected from memory.  The in-
> memory cache uses a MRU (most recently used) paradigm 
> to determine what should stay in memory, so when an 
> object becomes the least recently used, it is dumped 
> to the on-disk cache.
> 
> In your case with lots of users spread out over long 
> periods of time, you'll be using the on-disk cache quite 
> a bit.
> 
> > 2. Can Cocoon's caching algorithm be configured to
> > determine if any of my xml nodes has changed since the
> > last html view generation?
> > </QUESTIONS>
> 
> This happens out of the box.  By default if your source 
> is a file on the filesystem (as in your case) it will 
> examine the last modified date of the file.
> 
> Some other things to note: 
> 1) The cached object stored on disk is not a .html file - 
> it is a serialized version of what is called a "compiled 
> byte stream" that the cache uses natively.
> 2) Cocoon also stores it's internal pipeline related 
> objects in this way - for instance, IIUC even an xsl 
> file that is used in a transformation step is stored in 
> this way in special pre-parsed format that gains a lot 
> of efficiency when Cocoon reads it back in. 
> 3) See the "status" sample for a peek into the cached objects, 
> and the clear cache samples as well.
> 4) The cache is called a "store" in the code and cocoon.xconf
> 5) In Cocoon 2.1 there are three pipeline implementations that 
> you can use in any combination in any sitemap: caching, non-caching, 
> and caching-point.  Cocoon 2.0 only had the first two, and 
> I don't remember if you could mix them in your application.
> 6) Even in caching pipelines, Cocoon makes decisions about 
> whether a pipeline is cacheable based on the specific pipeline 
> components (combo of generator, transformers, and serializers) 
> and their configuration and parameters.
> 
> You should read up on the details of all these in the docs.
> 
> HTH,
> Geoff Howard
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org
> 
> 
> 

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


RE: Caching and Generator Concurrency

Posted by Geoff Howard <co...@leverageweb.com>.
> -----Original Message-----
> From: Julian [mailto:cerebro70@yahoo.com]
...
> <SCENARIO>
> I want to generate an html view of various xml nodes
> stored on the  filesystem.  The view may be requested
> once a month or as little as once a year.  The system
> has a few thousand users each with various html views.
> </SCENARIO>
> 
> <QUESTIONS>
> 1. Can Cocoon use the cached html view rather than
> generating a new html document over long periods of
> time and multiple reboots?  

Yes, in fact it will do this by default.  Depending on 
how you are assembling your view, you will need to take 
different steps to ensure cachability.  (also specific 
steps and options depend on which version of Cocoon).

Cocoon has two levels of caching - an in memory cache 
with configurable size limits and other options (see 
cocoon.xconf).  By default out of the box, this is con-
figured with a backup on-disk cache where the in-memory 
objects go when the are ejected from memory.  The in-
memory cache uses a MRU (most recently used) paradigm 
to determine what should stay in memory, so when an 
object becomes the least recently used, it is dumped 
to the on-disk cache.

In your case with lots of users spread out over long 
periods of time, you'll be using the on-disk cache quite 
a bit.

> 2. Can Cocoon's caching algorithm be configured to
> determine if any of my xml nodes has changed since the
> last html view generation?
> </QUESTIONS>

This happens out of the box.  By default if your source 
is a file on the filesystem (as in your case) it will 
examine the last modified date of the file.

Some other things to note: 
1) The cached object stored on disk is not a .html file - 
it is a serialized version of what is called a "compiled 
byte stream" that the cache uses natively.
2) Cocoon also stores it's internal pipeline related 
objects in this way - for instance, IIUC even an xsl 
file that is used in a transformation step is stored in 
this way in special pre-parsed format that gains a lot 
of efficiency when Cocoon reads it back in. 
3) See the "status" sample for a peek into the cached objects, 
and the clear cache samples as well.
4) The cache is called a "store" in the code and cocoon.xconf
5) In Cocoon 2.1 there are three pipeline implementations that 
you can use in any combination in any sitemap: caching, non-caching, 
and caching-point.  Cocoon 2.0 only had the first two, and 
I don't remember if you could mix them in your application.
6) Even in caching pipelines, Cocoon makes decisions about 
whether a pipeline is cacheable based on the specific pipeline 
components (combo of generator, transformers, and serializers) 
and their configuration and parameters.

You should read up on the details of all these in the docs.

HTH,
Geoff Howard

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


Re: Caching and Generator Concurrency

Posted by Bertrand Delacretaz <bd...@codeconsult.ch>.
You might want to start by looking at the XSP cacheable sample 
(http://localhost:8888/samples/xsp/java/cacheable in the current build) 
which demonstrates the basic principles of Cocoon caching.

-Bertrand


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