You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Paulo Gaspar <pa...@krankikom.de> on 2001/02/19 02:09:03 UTC

Class loading impact on performance?

Did anyone notice this posting?

<pulp>
> 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.
</pulp>

The original posting:

> -----Original Message-----
> From: Edwards, Peter [mailto:Peter.Edwards@astrazeneca.com]
> Sent: Friday, February 16, 2001 15:19
> To: 'tomcat-user@jakarta.apache.org'; 'xerces-j-dev@xml.apache.org';
> 'xalan-j-user@xml.apache.org'
> Subject: 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, email: tomcat-user-help@jakarta.apache.org
>


Re: Class loading impact on performance?

Posted by cm...@yahoo.com.
> <pulp>
> > 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.
> </pulp>

It may be - that's why we have 3.3 :-) Xalan, xerces, are loading a lot of
classes - but this is only startup time. 

Thanks to Nacho, most of the class loading problems are resolved 
( well, I also had a small contribution, so did Henri and Larry :-) - and
it seems the loading speed is pretty good now. 
 
Unfortunately it's very hard ( and dangerous ) to port the changes to
3.2.x.

Tomcat 3.3 uses only URLClassLoader - if JDK1.2 is detected - and only
"standard" parent delegation. I tested it with xerces, jaxp1.1, etc - it
all seems to work.

The only problem is that by default, no parser is provided to applications
- I'm working on a  solution that will allow the admin to specify that an
application needs a parser ( and what parser to provide by default ).
( in other words - to define different "profiles" - the default will
probably remain the most conservative - no library provided by the
container )

Costin