You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Stoski <RS...@haesoft.com> on 2011/07/19 22:25:37 UTC

Tomcat 7 Performance Issues when retriving JAR files during TLD file parsing.

Hi,

We recently updated our development environment from Tomcat 6.0.29 to 7.0.19 and noticed a large decrease in performance where pages that would load in < 1 second now taking > 5 seconds to load.

Profiling the webapp through Netbeans, we narrowed down the problem to a method retrieving a JarFile object inside org.apache.jasper.compiler.ParseController when parsing TLD files.

Screenshots of the Profiler Hotspots and Call Tree from both versions of Tomcat are available here: http://imgur.com/a/ZmeWM

A comparison of the getJarFile() methods shows few differences:
Tomcat 7: org.apache.jasper.compiler.JarURLResource
public JarFile getJarFile() throws IOException {
    URL jarFileUrl = new URL("jar:" + jarUrl + "!/");
    JarURLConnection conn = (JarURLConnection) jarFileUrl.openConnection();
    conn.setUseCaches(false);
    conn.connect();
    return conn.getJarFile();
}

Tomcat 6: org.apache.japser.compiler.ParserController
private JarFile getJarFile(URL jarFileUrl) throws IOException {
    JarFile jarFile = null;

    if (jarFileUrl != null) {
        JarURLConnection conn = (JarURLConnection) jarFileUrl.openConnection();
        conn.setUseCaches(false);
        conn.connect();
        jarFile = conn.getJarFile();
    }

    return jarFile;
}


>From the call trees, Tomcat 7's instantiation of a URL object on each invocation is not the cause of the problem. Extracting the URL paths with a debugger gave the following results:

Tomcat 6: "file:/C:/svn/[PATH_TO_PROJECT]/server/target/snapshot/WEB-INF/lib/[OUR_JAR].jar!/"

Tomcat 7: "jndi:/localhost/snapshot/WEB-INF/lib/[OUR_JAR].jar!/"

Our best guess is that the different handlers for the URL objects are causing our performance issues.


Has anyone else experienced this issue under Tomcat 7 or knows how we could go about resolving this problem?

Thanks,


RE: Tomcat 7 Performance Issues when retriving JAR files during TLD file parsing.

Posted by Robert Stoski <RS...@haesoft.com>.
Thanks, Mark. We found some information regarding performance issues in Tomcat 7 but could not relate them to the problem we were seeing.

This has been raised as bug 51532 (http://issues.apache.org/bugzilla/show_bug.cgi?id=51532).

-----Original Message-----
From: Mark Thomas [mailto:markt@apache.org] 
Sent: July-19-11 3:32 PM
To: Tomcat Users List
Subject: Re: Tomcat 7 Performance Issues when retriving JAR files during TLD file parsing.

On 19/07/2011 21:25, Robert Stoski wrote:
> Our best guess is that the different handlers for the URL objects are causing our performance issues.

That looks familiar.

Tomcat 7 re-factored the Jar scanning so that consistent code (that
fixed some edge case bugs) was used for annotation scanning, TLD
scanning etc as well as making the whole process extensible.

Along the way, a few places that used file URLs switched to JNDI urls
and in some cases that triggered a performance hit. Looks liek you have
found another one. Open a bugzilla issue and soemone should take a look
for the 7.0.20 release.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7 Performance Issues when retriving JAR files during TLD file parsing.

Posted by Mark Thomas <ma...@apache.org>.
On 19/07/2011 21:25, Robert Stoski wrote:
> Our best guess is that the different handlers for the URL objects are causing our performance issues.

That looks familiar.

Tomcat 7 re-factored the Jar scanning so that consistent code (that
fixed some edge case bugs) was used for annotation scanning, TLD
scanning etc as well as making the whole process extensible.

Along the way, a few places that used file URLs switched to JNDI urls
and in some cases that triggered a performance hit. Looks liek you have
found another one. Open a bugzilla issue and soemone should take a look
for the 7.0.20 release.

Mark



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org