tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <John.E.Gr...@wellsfargo.com.INVALID>
Subject RE: Performance test with Tomcat 9 shows increased cpu/disk usage because of repeated opening/closing of jars in WEB-INF/lib
Date Thu, 10 Oct 2019 22:54:03 GMT
Tony,


> -----Original Message-----
> From: Rhuberg,Anthony <Anthony.Rhuberg@Cerner.com.INVALID>
> Sent: Thursday, October 10, 2019 5:22 PM
> To: Tomcat Users List <users@tomcat.apache.org>
> Subject: RE: Performance test with Tomcat 9 shows increased cpu/disk usage
> because of repeated opening/closing of jars in WEB-INF/lib
> 
> We are still investigating what specific classloader reads that would trigger
> the repeated reload of the web-inf/lib/*.jars.
> 
> One example we found is the use of
> javax.xml.transform.TransformerFactory.newInstance(). One of its features
> is to determine the implementation by searching for the configuration
> specified by META-INF/services/javax.xml.transform.TransformerFactory in
> jars available to the runtime.
> 

Yep.  I was wondering about that.  I have no idea why this behavior would be different in
Tomcat 9, though.  Did you change Java versions also?  Is the classpath longer?

I also have no idea about the jar modification date changes that you're seeing.

I do have first-hand experience with the performance of TransformerFactory.newInstance().
 In general, anything that uses the service locator under the covers, such as TransformerFactory,
DocumentBuilderFactory, etc, should be reused if possible.  Those XML factories are thread
safe, though the things created by the factories are typically not thread safe.  You should
create it once, configure it once, and use it as many times as necessary.  For example, you
would create one TransformerFactory, then call newTransformer() as many times as necessary.

John
Mime
View raw message