[Setup] huge performance issues using Diazo

Laurence Rowe l at lrowe.co.uk
Sat Mar 17 01:08:19 UTC 2012


hvelarde wrote
> 
> On 15/03/12 06:11, Laurence Rowe wrote:
>> plone.app.theming.transform.transformIterable should be called only once
>> per
>> request, I would suggest working out why is being called so many times.
> 
> no, plone.app.theming.transform.transformIterable is called on _every_ 
> request; it just exits early if the content isn't Diazo's business, but 
> that's another story.
> 
> after more profiling I have found that all the delay happens inside this 
> method when the rules are applied and it's very different depending on 
> what kind of page is being processed; it's becoming critical on content 
> creation (30s vs 1s with no Diazo theme applied).
> 

Are you are running in production mode? bin/instance console rather than
bin/instance fg if you want to run non-daemonised. If you run in debug mode
then the whole theme is compiled down to XSLT every request (so changes in
your theme appear immediately.)

What does your profiling data say for that single request? How much time is
spent in the transformIterable and then how much applying the XSLT itself?
libxslt is generally pretty fast and you generally need a very long document
before you need to worry about optimising your xpaths.



> we're right now working on a complete refactoring of the rules, but I 
> think it's important to give more information to theme developers about 
> how complex sites performance could be affected by Diazo and what are 
> the best practices do deal with this.
> 
> as I mentioned before, this is extremely important on the content 
> creation side because (and correct me if I'm wrong) no caching can be 
> applied there and the delay occurs all the time.
> 

Running the XSLT to apply a Diazo theme is usually orders of magnitude
faster than rendering the Plone page to begin with. If you are seeing really
slow rendering and you are sure that the time is being spent applying the
XSLT then you have a couple of options:

1. Simple binary search. Remove half your theme, rerun it and see how long
it takes. If it's taking 30s then you can do that in development mode, even
when compiling the theme every request Diazo should take < 1s. (I would
conside 10-50ms to be normal, but obviously it depends on the complexity of
your theme.)

2. Compile your theme with the standalone Diazo and use xsltproc --timing to
see how long it takes. This is a trivial theme and content document:

$ bin/diazocompiler -r rules.xml -o compiled.xsl
$ xsltproc --timing --repeat --html --noout compiled.xsl content.html 
Parsing stylesheet compiled.xsl took 0 ms
Parsing document content.html took 0 ms
Applying stylesheet 20 times took 5 ms

Using the plone.org theme (compiled with an old version of xdv which
produces slightly slower XSLT) against a 563KB page (the source to
http://plone.org/documentation/manual/theme-reference/referencemanual-all-pages)
is

$ xsltproc --html --timing --noout default.xsl
theme-reference-all-pages.html
Parsing stylesheet default.xsl took 1 ms
# lots of warnings about invalid html, they are ignored so don't worry.
Parsing document theme-reference-all-pages.html took 35 ms
Applying stylesheet took 217 ms

(Unfortunately the xsltproc --profile only gives per template statistics
which is not very useful for us.)

Laurence

--
View this message in context: http://plone.293351.n2.nabble.com/huge-performance-issues-using-Diazo-tp7372056p7380644.html
Sent from the Installation, Setup, Upgrades mailing list archive at Nabble.com.


More information about the Setup mailing list