cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Payne" <scott.pa...@publicimage.eu.com>
Subject Re: Caching of generated XSP.
Date Wed, 14 Jul 2004 08:34:35 GMT
Thanks for the reply. Now I have a new spanner to throw in the works.

Our new sitemap actually looks more like this:

<map:match pattern="src-*">
  <map:generate src="store/site.xml" type="file"/>
  <map:transform src="xsl/site2page.xsl" label="page">
    <map:parameter name="id" value="{1}"/>
  </map:transform>
  <map:transform src="xsl/page2xsp.xsl"/>
  <map:serialize type="xml"/>
</map:match>

<map:match pattern="view-*">
  <map:generate src="cocoon:/src-{1}" type="serverpages" label="xsp"/>
  <map:transform src="xsl/whirlwind.xsl" label="source"/>
  <map:serialize/>
</map:match>

I have also tried to make the generated XSP page cacheable by implementing
the getValidity() method which just gets the validity of the store/site.xml
file. I also implemented a modifiedSince(long) method which checks its
argument against the timestamp of that file.

It seems like the modifiedSince method always gets passed a value of 0,
which seems to make sense for a generated page, but it does mean that
modifedSince will always return true.

I've also noticed that ProgramGeneratorImpl doesn't check the validity
object of the Source object when determining whether to regenerate the
source file. I did try changing it to do so but the SourceValidity returned
by source.getValidity() always seems to be valid. I'm not sure how relevant
this is.

Thanks in advance if anyone can help get this caching issue solved.

Relevent log entries follow:

In sitemap.log we have the following lines, which seem to indicate that
caching is happening for the src-* match:

DEBUG   (2004-07-14) 17:28.44:561   [sitemap] (/whirlwind/whirlwind/view)
http8080-Processor25/AbstractCachingProcessingPipeline: Found cached
response for 'src-home' using key:
PK_G-file-file:/C:/Apache/Tomcat-5.0/webapps/whirlwind/whirlwind/store/site.
xml_T-xalan-file:/C:/Apache/Tomcat-5.0/webapps/whirlwind/whirlwind/xsl/site2
page.xsl;id=home_T-xalan-file:/C:/Apache/Tomcat-5.0/webapps/whirlwind/whirlw
ind/xsl/page2xsp.xsl
DEBUG   (2004-07-14) 17:28.44:561   [sitemap] (/whirlwind/whirlwind/view)
http8080-Processor25/AbstractCachingProcessingPipeline: validatePipeline:
using valid cached content for 'src-home'.

and the same for the view-* match:

DEBUG   (2004-07-14) 17:28.45:077   [sitemap] (/whirlwind/whirlwind/view)
http8080-Processor25/AbstractCachingProcessingPipeline: Found cached
response for 'view-home' using key:
PK_G-serverpages-cocoon://whirlwind/src-home?pipelinehash=-67131052139127767
47-org.apache.cocoon.www.cocoon_.whirlwind.src_home_pipelinehash__6713105213
912776747_T-xalan-file:/C:/Apache/Tomcat-5.0/webapps/whirlwind/whirlwind/xsl
/whirlwind.xsl_S-html-1

Now, in core.log we get the normal sort of instantiation of the xsp file:

DEBUG   (2004-07-14) 17:28.39:795   [core.program-generator]
(/whirlwind/whirlwind/view) http8080-Processor25/ProgramGeneratorImpl: The
serverpage [cocoon://whirlwind/src-home?pipelinehash=-6713105213912776747]
is not in the cache yet
INFO    (2004-07-14) 17:28.39:795   [core.program-generator]
(/whirlwind/whirlwind/view) http8080-Processor25/ProgramGeneratorImpl: The
serverpage [cocoon://whirlwind/src-home?pipelinehash=-6713105213912776747]
could not be preloaded, will be re-created
(org.apache.cocoon.components.language.LanguageException: Unable to preload
program
org\apache\cocoon\www\cocoon_\whirlwind\src_home_pipelinehash__6713105213912
776747: org.apache.cocoon.components.language.LanguageException: Could not
load class for program
'org\apache\cocoon\www\cocoon_\whirlwind\src_home_pipelinehash__671310521391
2776747' due to a java.lang.ClassNotFoundException:
org.apache.cocoon.www.cocoon_.whirlwind.src_home_pipelinehash__6713105213912
776747)
DEBUG   (2004-07-14) 17:28.39:795   [core.program-generator]
(/whirlwind/whirlwind/view) http8080-Processor25/ProgramGeneratorImpl:
Creating new serverpage for
[cocoon://whirlwind/src-home?pipelinehash=-6713105213912776747]
DEBUG   (2004-07-14) 17:57.17:420   [core.program-generator]
(/whirlwind/whirlwind/view) http8080-Processor25/ProgramGeneratorImpl:
Creating sourcecode for
[cocoon://whirlwind/src-home?pipelinehash=-6713105213912776747]

Further on though we get the following:

DEBUG   (2004-07-14) 17:28.44:561   [core.program-generator]
(/whirlwind/whirlwind/view) http8080-Processor25/ProgramGeneratorImpl:
ReCreating serverpage for
[cocoon://whirlwind/src-home?pipelinehash=-6713105213912776747]
...
DEBUG   (2004-07-14) 17:28.44:561   [core.program-generator]
(/whirlwind/whirlwind/view) http8080-Processor25/ProgramGeneratorImpl:
Creating sourcecode for
[cocoon://whirlwind/src-home?pipelinehash=-6713105213912776747]
...
DEBUG   (2004-07-14) 17:28.44:811   [core.language.java]
(/whirlwind/whirlwind/view) http8080-Processor25/JavaLanguage: Compiling
C:\Apache\Tomcat-5.0\work\Catalina\localhost\whirlwind\cocoon-files\org\apac
he\cocoon\www\cocoon_\whirlwind\src_home_pipelinehash__6713105213912776747.j
ava

and this repeats for subsequent invocations.

We do get the following in core.log which indicates that the SitemapSource
may be caching correctly:

DEBUG   (2004-07-14) 17:28.45:077   [core.store] (/whirlwind/whirlwind/view)
http8080-Processor25/JCSDefaultStore: Found key:
PK_G-serverpages-cocoon://whirlwind/src-home?pipelinehash=-67131052139127767
47-org.apache.cocoon.www.cocoon_.whirlwind.src_home_pipelinehash__6713105213
912776747_T-xalan-file:/C:/Apache/Tomcat-5.0/webapps/whirlwind/whirlwind/xsl
/whirlwind.xsl_S-html-1


----- Original Message -----
From: "Vadim Gritsenko" <vadim@reverycodes.com>
To: <dev@cocoon.apache.org>
Sent: Thursday, July 08, 2004 11:56 PM
Subject: Re: Caching of generated XSP.


> Scott Payne wrote:
>
> >Hi,
> >
> >I'm taking up a thread about caching of generated XSPs started at
> >http://marc.theaimsgroup.com/?l=xml-cocoon-users&m=107880112301284&w=2.
> >
> >
>
> Snippet from this link:
>
> ><map:match pattern="page-*.xsp">
> >   <map:generate src="page.xsp" type="serverpages"/>
> >   <map:transform src="generate-xsp.xsl"/>
> >   <map:serialize type="xml"/>
> ></map:match>
> >
> ><map:match pattern="page-*">
> >   <map:generate src="cocoon:/page-{1}.xsp" type="serverpages"/>
> >   <map:transform src="tohtml.xsl"/>
> >   <map:serialize type="html"/>
> > </map:match>
> >
>
>
> >I've ported the patches in
> >http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26725 to the 2.1.5
source
> >but we still seem to have a bit of a bottle-neck.
> >
> >Although the new EnvironmentWrapper now has a getLastModified() method,
the
> >lastModified field is only set by the isResponseModified() method, which
> >doesn't seem to be called for the generated content. Therefore the
> >getLastModified() method always returns 0, and the java file always gets
> >regenerated.
> >
> >So, my question is, has anyone tried to get this working without the
> >regeneration? Is there somewhere appropriate we should set the
lastModified
> >time for the SitemapSource instance representing the generated XSP?
> >
> >
>
> Looking at the sitemap snippet above, the answer is, page.xsp should be
> cacheable, and I guess it is not cacheable at the moment. See XSP
> examples for the details.
>
> Vadim
>



Mime
View raw message