You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Kris Rasmussen <kr...@yahoo.com> on 2003/04/01 22:43:29 UTC

database caching

How does cocoon handle caching of xsp pages with esql tags? It seems to me that cocoon would have to generate the xml output of the xsp page every time the page is called, and thus would be unable to cache any xsl translation latter? Is this true? If so would it not be a better idea to have the page be translated into html before all database code is called and then insert the database code at the very end and output as a jsp page or something?

Kris



---------------------------------
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more

Re: database caching

Posted by "Marcelo F. Ochoa" <mo...@ieee.org>.
Kris Rasmussen wrote:

> How does cocoon handle caching of xsp pages with esql tags? It seems 
> to me that cocoon would have to generate the xml output of the xsp 
> page every time the page is called, and thus would be unable to cache 
> any xsl translation latter? Is this true? If so would it not be a 
> better idea to have the page be translated into html before all 
> database code is called and then insert the database code at the very 
> end and output as a jsp page or something?
>
> Kris
>
  You can use DBPrism external invalidator server for Cocoon 
(http://www.dbprism.com.ar/dbprism/doc/xdocs/Server.html), it use ESI 
invalidation protocol (http://www.w3.org/TR/esi-invp) to control the 
cache coherence betwen Cocoon and the database server.
   Now DBPrism external invalidator server is separate component of 
DBPrism which can be used into Cocoon and XSP pages without installing 
DBPrism.
   The flow of invalidation messages is detailed at: 
http://www.dbprism.com.ar/dbprism/doc/cms/CMS-WebCache.html .
   A simple usage of this cache scheme could be tested at 
http://www.dbprism.com.ar/dbprism/xsp/simple_ext the source of this page 
is at 
http://www.dbprism.com.ar/dbprism/view-source?filename=/docs/samples/xsp/simple_ext.xsp
   This XSP page is valid (cached) until Cocoon receives an invalidation 
message from an external resource (database or a simple telnet session), 
note that the signature of the page shows a server time that never change.
   The caching behaviour is configure through a sitemap parameter like this:

    <map:generate src="xsp/{1}.xsp" type="serverpages">
        <map:parameter name="ESI-Key-Pattern" 
value="ParameterPattern=id_user"/>
        <map:parameter name="test_param1" value="test1"/>
        <map:parameter name="test_param2" value="test2"/>
    </map:generate>

   ESI-Key-Pattern parameter controls which argument, cookie or header 
defines a personalization tag, or the discrimination value for the same 
page, for example a page like my.yahoo.com could include a cookie value 
which control different pages for every different logged user, in that 
case Cocoon will store different pages for each user logged, on the 
example above only id_user http parameter is used as personalization key.
   The new implementatin of DBPrism invalidator server (available 
through CVS 
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dbprism/prism/bin/) 
includes a new imlementation using HSQLDB in memory database it is 
slightly slow than the previous one implementation using Hashmaps but 
more scalable.
  A sub sitemap example is available at 
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/dbprism/cms/dbprism/ext/ 
if you need more information sent me an email.
  Best regards, Marcelo.

-- 
Marcelo F. Ochoa - mochoa@ieee.org
Do you Know DB Prism? Look @ http://www.dbprism.com.ar/dbprism/doc/Home.html
More info?
Chapter 21 of the book "Professional XML Databases" (Wrox Press 
http://www.wrox.com/)
Chapter 8 of the book "Oracle & Open Source" (O'Reilly 
http://www.oreilly.com/catalog/oracleopen/)
-----------------------------------------------
Lab. de Sistemas - Fac. de Cs. Exactas - UNICEN
Paraje Arroyo Seco - Campus Universitario
(7000) Tandil - Bs. AS. - Argentina
Te: +54-2293-444430 Fax: +54-2293-444431




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


AW: memory on the status page

Posted by Marco Rolappe <m_...@web.de>.
hi bert,

the 119MB is the amount of memory used by the java process (i.e. heap and
other resources).

the -Xmx parameter specifies the maximum size of the heap, i.e. not the
maximum size of memory used by the process.

the other numbers tell you that the heap's current size is 64MB of which
19MB are free.


to tune the memory parameters you can do the following:
 - enable logging for the store janitor (component that can flush
stores/caches when memory gets low)
 - have it enabled long enough a period and have the webapp used
 - the store janitor logs the values mentioned (current total and free heap
sizes) in a determined interval
 - later you can infer from those logs a more or less optimal value for the
maximum heap size

and you might want to restrict those memory settings to tomcat by setting
CATALINA_OPTS instead of JAVA_OPTS

> -----Ursprungliche Nachricht-----
> Von: cocoon-users-return-48706-m_rolappe=web.de@xml.apache.org
> [mailto:cocoon-users-return-48706-m_rolappe=web.de@xml.apache.org]Im
> Auftrag von Bert Van Kets
> Gesendet: Donnerstag, 3. April 2003 21:13
> An: cocoon-users@xml.apache.org
> Betreff: memory on the status page
>
>
> Hi all,
> I have Cocoon configured on a Windows2K server that is using JDK
> 1.3.1 and
> Tomcat 4.0.6.
> The JAVA_OPTS environment variable is set to -Xmx256m
> Tomcat is setup as a service and is using 119MB of memory.
> When I call the status page it tells me there's 64MB of memory
> and 19MB is
> available.
>
> What do these numbers actually represent?
> I have had loads of OutOfMemory problems, that seem to be solved
> now.  I'd
> like to have a good and clean look on memory consumption.
> Can anybody explain this please?
>
> Thanks a lot,
> Bert
>
>
> ---------------------------------------------------------------------
> 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


memory on the status page

Posted by Bert Van Kets <be...@apache.org>.
Hi all,
I have Cocoon configured on a Windows2K server that is using JDK 1.3.1 and 
Tomcat 4.0.6.
The JAVA_OPTS environment variable is set to -Xmx256m
Tomcat is setup as a service and is using 119MB of memory.
When I call the status page it tells me there's 64MB of memory and 19MB is 
available.

What do these numbers actually represent?
I have had loads of OutOfMemory problems, that seem to be solved now.  I'd 
like to have a good and clean look on memory consumption.
Can anybody explain this please?

Thanks a lot,
Bert


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


Re: database caching

Posted by Geoff Howard <co...@leverageweb.com>.
I see - interesting idea.  You are wanting to use requests to trigger 
uncache events, similar to the asynchronous reload behavior of the sitemap 
(or was that cocoon.xconf? or web.xml??).

But you are still doing that work for every request in your scheme, which 
if you have a high load won't necessarily give better performance.

Why not do a time-based cache that expires every second or minute, etc.?

I had been wanting to allow for asynchronous cache behavior and will look 
into it, but for now if you really want to go that way you'll either need 
to do it that way yourself, or write a custom transformer to do that as you 
proposed.  I tend to dislike transformers with side effects in that sort of 
scenario, but it should work.

Geoff

At 01:54 PM 4/2/2003, you wrote:

>I realize my approach is somewhat reversed, however, in pages that are 
>accessed and change often it seems like it might be necessary to obtain 
>acceptable performance. For example, if I had a poll on a home page that 
>changes every second or so, it would be a huge waste to output the current 
>value of the poll (a single number) every time the page is accessed and 
>then regenerate the xml for the whole page and then transform it all 
>again. Rather, it seems that it would be much more efficient if the call 
>to the database was put off until the entire page was transformed and 
>cached first. I realize this is possible to do with cocoon with 
>transformers, however I was curious if there was any way to do it with 
>esql and xsp.
>
>Please correct me if I am wrong, or if this added complexity for high 
>traffic pages is not necessary.
>
>Kris
>
>  Leszek Gawron <ou...@vip.net.pl> wrote:
>
>On wto, kwi 01, 2003 at 12:43:29 -0800, Kris Rasmussen wrote:
> >
> > How does cocoon handle caching of xsp pages with esql tags? It seems to 
> me that cocoon would have to generate the xml output of the xsp page 
> every time the page is called, and thus would be unable to cache any xsl 
> translation latter? Is this true? If so would it not be a better idea to 
> have the page be translated into html before all database code is called 
> and then insert the database code at the very end and output as a jsp 
> page or something?
>Is that the way other server side frameworks do? Remember that the most
>important thing is data, which is being generated at the beginning and then
>the presentation is applied. Your approach is completely reversed.
>
>Take look at Velocity - maybe it could solve your problems
>ouzo
>
>--
>__
>| / \ | Leszek Gawron // \\
>\_\\ //_/ ouzo@vip.net.pl _\\()//_
>.'/()\'. Phone: +48(600)341118 / // \\ \
>\\ // recursive: adj; see recursive | \__/ |
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
>For additional commands, e-mail: 
><ma...@xml.apache.org>cocoon-users-help@xml.apache.org
>
>
>
>
>
>Do you Yahoo!?
><http://us.rd.yahoo.com/finance/mailsig/*http://tax.yahoo.com>Yahoo! Tax 
>Center - File online, calculators, forms, and more


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


Re: database caching

Posted by Kris Rasmussen <kr...@yahoo.com>.
I realize my approach is somewhat reversed, however, in pages that are accessed and change often it seems like it might be necessary to obtain acceptable performance. For example, if I had a poll on a home page that changes every second or so, it would be a huge waste to output the current value of the poll (a single number) every time the page is accessed and then regenerate the xml for the whole page and then transform it all again. Rather, it seems that it would be much more efficient if the call to the database was put off until the entire page was transformed and cached first. I realize this is possible to do with cocoon with transformers, however I was curious if there was any way to do it with esql and xsp.
Please correct me if I am wrong, or if this added complexity for high traffic pages is not necessary.
Kris
 Leszek Gawron <ou...@vip.net.pl> wrote:
On wto, kwi 01, 2003 at 12:43:29 -0800, Kris Rasmussen wrote:
> 
> How does cocoon handle caching of xsp pages with esql tags? It seems to me that cocoon would have to generate the xml output of the xsp page every time the page is called, and thus would be unable to cache any xsl translation latter? Is this true? If so would it not be a better idea to have the page be translated into html before all database code is called and then insert the database code at the very end and output as a jsp page or something?
Is that the way other server side frameworks do? Remember that the most
important thing is data, which is being generated at the beginning and then
the presentation is applied. Your approach is completely reversed. 

Take look at Velocity - maybe it could solve your problems
ouzo

-- 
__
| / \ | Leszek Gawron // \\
\_\\ //_/ ouzo@vip.net.pl _\\()//_
.'/()\'. Phone: +48(600)341118 / // \\ \
\\ // recursive: adj; see recursive | \__/ |


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


 



---------------------------------
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more

Re: database caching

Posted by Leszek Gawron <ou...@vip.net.pl>.
On wto, kwi 01, 2003 at 12:43:29 -0800, Kris Rasmussen wrote:
> 
> How does cocoon handle caching of xsp pages with esql tags? It seems to me that cocoon would have to generate the xml output of the xsp page every time the page is called, and thus would be unable to cache any xsl translation latter? Is this true? If so would it not be a better idea to have the page be translated into html before all database code is called and then insert the database code at the very end and output as a jsp page or something?
Is that the way other server side frameworks do? Remember that the most
important thing is data, which is being generated at the beginning and then
the presentation is applied. Your approach is completely reversed. 

Take look at Velocity - maybe it could solve your problems
	ouzo

-- 
            __
         | /  \ |        Leszek Gawron            //  \\
        \_\\  //_/      ouzo@vip.net.pl          _\\()//_
         .'/()\'.     Phone: +48(600)341118     / //  \\ \
          \\  //  recursive: adj; see recursive  | \__/ |


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


Re: database caching

Posted by Geoff Howard <co...@leverageweb.com>.
Cocoon does not automatically cache xsp pages with esql tags, but provides 
a means for you to tell it to do so.  Have a look at the caching xsp 
sample, and probably the javadocs for the caching related classes.

In general, you'll need your generator (which is what your xsp produces 
automatically) to provide two things: a unique key that distinguishes the 
current result from others the same generator creates.  Generally, you'd 
want to hash any information the esql uses - probably from the request - 
and use that as your key.  Second, you need to provide information about 
the scheme you want Cocoon's cache to use to figure out if the cached 
content it holds is still valid.  The easiest in the case of database 
results is to do time-based validity.  Cache until a certain time, or for a 
certain duration.

If you need more information, you'll need to specify what version you're 
working on.

HTH,
Geoff Howard

At 03:43 PM 4/1/2003, you wrote:

>How does cocoon handle caching of xsp pages with esql tags? It seems to me 
>that cocoon would have to generate the xml output of the xsp page every 
>time the page is called, and thus would be unable to cache any xsl 
>translation latter? Is this true? If so would it not be a better idea to 
>have the page be translated into html before all database code is called 
>and then insert the database code at the very end and output as a jsp page 
>or something?
>
>Kris
>
>
>
>Do you Yahoo!?
><http://us.rd.yahoo.com/finance/mailsig/*http://tax.yahoo.com>Yahoo! Tax 
>Center - File online, calculators, forms, and more


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