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,

Reply via email to