[xslt] libxslt processor dump/load



Hello all,

The web development company I work for is using libxsl via PHP5.
We have a build environment which will create static html where possible, 
however we are currently using the same stylesheets to transform the xml 
dynamically where we have to. We have noticed that with large stylesheets 
(174k all up)  there is significant overhead in actually importing the 
stylesheet
i.e $xsltprocessor->importStylesheet( $xsldom );
which i believe calls the function xsltParseStylesheet in xslt.c . 

At a light to moderate load this works well but our request / second average 
does degrade fairly quickly when additional load is placed on the server. 
(more so with OpenBSD for some reason)

The building and manipulation of the  DomDocument, and the actual processing 
of the style sheets however are extremely fast.

I understand that this is not at all a bug, and the intention of the the  
xsltprocessor is to build it and process many times. Unfortunately, I don't 
know of a way to do this with scripting languages such as  php etc... 
which are run on a per apache child basis. Since we are hosting many small 
sites, having memory resident objects sitting idle most of the time is not 
really ideal  either.
 

Aside from reducing the  bulk of the XSLT, is there anything that can be done 
from an XSL stylesheet POV or from a libxslt POV to reduce the  overhead  of 
importing the stylesheet?

We've spent the last 2 weeks going over various solutions, axkit, mod_xslt, 
xstlc etc.. and I have posted to the xslt users list and none of them are 
really optimal for our needs / setup for various reasons.

The best solution for us and indeed most small multi-site development 
companies, would be to be able dump/save/cache in some way (disk would be 
ideal), a complete xslt processor after it has loaded the stylesheet. On  a 
request, get libxsl to 'import' this  pre-built xslt processor, at which we 
can throw our xml to be transformed. 

First of all is this at all possible and secondly is it even a good idea?

It's really not an overall performance thing, it's more about per request 
latency. We aren't in a position to trade memory for latency due to how PHP 
works, but we think with something like this, we could reach a more than 
acceptable latency.


Thanks in Advance
Andrew M

Katalyst Web Design


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]