Hi Lenya devs,

I did some profiling during the last weeks. One of the most expensive
operations in Lenya is resolving fallback:// URLs, for the following
reasons:


1. The URLs are context-sensitive.

Resolving a fallback URL requires knowledge about the current
publication. Currently this is done by the Avalon Contextualize
mechanism. Because of this, the FallbackSourceFactory can't be
ThreadSafe, and needs to lookup its services upon each source resolving,
which is a quite expensive operation.

A possible solution would be to pass the ID of the current publication
to the fallback URL, for instance

  fallback://{pubId}:xslt/foo2bar.xsl

This would also fix the template-fallback problem described in
http://issues.apache.org/bugzilla/show_bug.cgi?id=40564.

Unfortunately we can't make this optional, because the
FallbackSourceFactory is either ThreadSafe or not. But in a first step
we could introduce an additional protocol, e.g. pubfallback://. I
implemented this as a prototype in my sandbox, and it seems to work
fine. We can also do this if we defer the implementation until after the
release and recommend to change the URLs for better performance.


2. Checking the existence of the sources is expensive.

For each fallback source resolving, we check the existence in each
publication of the hierarchy, up to the core. This is of course quite
expensive. We could keep this for the "development" mode, and introduce
a "production" mode which caches all locations until the cache is
cleared manually.


What do you think about these ideas?

-- Andreas


-- 
Andreas Hartmann, CTO
BeCompany GmbH
http://www.becompany.ch


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to