cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donald Ball <>
Date Thu, 25 Jan 2001 20:19:23 GMT
On Thu, 25 Jan 2001, Marco Spinetti wrote:

> Hi all, my question is how I can increase my system performances. I
> have built a multiterminal Xml portal based on Cocoon: in the service
> of meteo forecasts for every request my system uses 1,6 second: using
> the Profiler.xml file I found out that this time is so subdivided:
> 36 ms (org-apache-cocoon-producer-ProducerFromFile)
> 408 ms (org.apache.cocoon.processor.xsp.XSPProcessor)
> 938 ms (org.apache.cocoon.processor.xslt.XSLTProcessor-1)
> 247 ms (org-apache-cocoon-formatter-HTMLFormatter)
> 54 ms (Outputting)

you can eliminate almost all of this time by having your xsp pages
implement a hasChanged method. i use this template in my main
site-specific logicsheet to seamlessly add one to all of my xsp pages:

<xsl:template match="xsp:page">
    <xsl:apply-templates select="@*|*|text()|processing-instruction()"/>
    static long last_changed_millis = 0;
    static final long MILLISECONDS_TO_CACHE = 5*60*1000;

    public boolean hasChanged(Object context) {
      long current_millis = System.currentTimeMillis();
      if (current_millis - MILLISECONDS_TO_CACHE &gt; last_changed_millis) {
        last_changed_millis = current_millis;
        return true;
      } else {
        return false;

this causes xsp output to cache for a five minutes at a time. it gave me a
speedup of over an order of magnitude.

- donald

View raw message