Re: Howto optimize XSL transformations (reuse compilations) on a web server?



peter.fredrikson@xxxxxxxxxx wrote:

My web server process every request by building a XML structure
containing both application data, data from the database (or another
system), and presentation data, describing how to present the
application data in the GUI. Then the web server transform this
XML-document to HTML with a XSL document. The XSL file actually
consists of 1 main XSL with include statements to 24 other XSL files,
so it's quite a large XSL document.

Most of the CPU time in my server is occupied by compiling the XSL
structure in every request. The compilation takes place when the Load()
method is called on an instance of the class XslCompiledTransform.

So my question is: Is there an smart way to cache the compiled version
of the XSL document on the server so I will not have to recompile it in
every request?

A little more background info/questionmarks to think about :
- I have a custom session component accessible through Web Service
calls on another server so I don't use IIS sessions.
- The solution must work in load balanced scenarios.
- I don't want the solution to block other requests by using critical
sections, or at least I want to minimize the impact of resours locking.

Well, unfortunately XslCompiledTransform doesn't allow to persist compilation results yet. So the only option for you is caching and precompilation - once loaded XslCompiledTransform object is thread safe for Transform() methods.


--
Oleg Tkachenko [XML MVP, MCAD]
http://www.XmlLab.Net | http://www.XLinq.Net | http://blog.tkachenko.com
.



Relevant Pages