You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Edwards, Peter" <Pe...@astrazeneca.com> on 2001/02/16 15:19:17 UTC

Xalan and Tomcat - installation and performance issues

I hope no-one minds me cross-posting this but it covers all areas.

I have had success using Xalan2 in a servlet on Tomcat3.2 and also found
some major performance problems. I thought it would be useful for people to
be aware of these problems and I would value any comments/suggestions.

First, I hit the well-known problem of clashing XML parsers. I solved this
by removing jaxp.jar and parser.jar from the tomcat\lib directory and
inserted xerces,jar in their place. This does not work on Tomcat3.1 since it
directly uses xml.jar - you have to add xerces to the classpath of the
server startup before the other jars.

I was then able to create a simple servlet using Xalan2 to perform a
transformation (using Transformer). I'm using JDK1.3, NT4 running on 600MHz
P3 with 256Mb RAM. The performance was appalling so I did a number of tests
with the following code:

    TransformerFactory tFactory = TransformerFactory.newInstance();	//
step1

    StreamSource style = new StreamSource(xsl);				//
step2
    StreamSource source = new StreamSource(xml);
    StreamResult res = new StreamResult(out);

    Transformer transformer = tFactory.newTransformer(style);		//
step3

    transformer.transform(source, res);					//
step4

Command line usage:
    Step1 - 280ms
    Step2 - 20ms
    Step3 - 3946ms
    Step4 - 531ms

Servlet in Tomcat 3.2.1
    Step1 - 2954ms
    Step2 - 421ms
    Step3 - 46266ms
    Step4 - 8442ms

As you can see, the performance degraded by about 10 times. I got around
this by going against everything I believed about  where to place libs in
tomcat and loaded all jars in the server startup script. The problem goes
away.

I believe this is a problem with class loading on Tomcat.

Pete Edwards