cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andreas Hartmann (JIRA)" <j...@apache.org>
Subject [jira] Commented: (COCOON-2166) Enable caching of IncludeTransformer if not all includes could be resolved
Date Sun, 10 Feb 2008 23:29:07 GMT

    [ https://issues.apache.org/jira/browse/COCOON-2166?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12567490#action_12567490
] 

Andreas Hartmann commented on COCOON-2166:
------------------------------------------

Vadim, thanks for your comment!

I noticed that my first approach was wrong. BTW, a workaround is to call a pipeline with a
resource-exists selector instead of using the <i:fallback/> element - in this case the
result is cached.

But I noticed another problem which in certain circumstances avoids caching of included sources
which have in turn MultiSourceValidities. If the new validity is already closed (which occurs
if the new source was resolved during the validity check), it doesn't have a resolver and
therefore validity.isValid(newValidity) returns INVALID. To avoid this situation, I implemented
a patch which doesn't try to obtain the resolver from closed sources but checks each validity
directly (see next attachment). Some tests indicate that with the patch the results are cached,
but I still can't tell if this approach is correct.

> Enable caching of IncludeTransformer if not all includes could be resolved
> --------------------------------------------------------------------------
>
>                 Key: COCOON-2166
>                 URL: https://issues.apache.org/jira/browse/COCOON-2166
>             Project: Cocoon
>          Issue Type: Improvement
>          Components: * Cocoon Core
>    Affects Versions: 2.1.12-dev (Current SVN)
>            Reporter: Andreas Hartmann
>         Attachments: patch-issue2166.txt
>
>
> About the context: In Lenya, we have a couple of modules, which are basically directories.
A module directory can include an optional menu.xml file. The Lenya GUI menubar is an aggregation
of all these menu.xml files, with some postprocessing. The same mechanism is used for the
i18n catalogue - modules can provide i18n catalogues for their GUIs.
> We use the IncludeTransformer to assemble the menu XML, ignoring the non-existing menus
using <i:fallback/>. It looks basically like this:
>   <xsl:forEach select="lenya:module">
>     <i:include src="cocoon:/menu-xml/module/{@name}.xml">
>       <i:fallback/>
>     </i:include>
>   </xsl:forEach>
> This is extremely fast if all modules contain menu.xml files, because the aggregated
XML is cached. But if some of the includes can't be resolved, nothing is cached. This causes
up to 50% more request processing time, so it has quite a big impact on the Lenya GUI performance
:)
> I tracked the source of the behaviour down to the MultiSourceValidity class. As soon
as one of the sources has no validity (IIUC this happens if a FileSource doesn't exist), the
whole MultiSourceValidity becomes invalid:
>   public void addSource(Source src) {
>       if (this.uris != null) {
>           SourceValidity validity = src.getValidity();
>           if (validity == null) {
>               /* The source has no validity: this will be
>                  always be invalid. */
>               this.uris = null;
> From my POV it would be better to ignore the non-existing sources, and check their existence
when the validity is computed the next time. I.e. MultiSourceValidity.isValid() would return
UNKNOWN, and isValid(newValidity) -> computeStatus() would check if newValidity provides
a validity for the formerly missing source.
> Do you think this behaviour would be reasonable? If yes, I'd try to implement it, preferrably
with test cases to avoid regressions. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message