You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Marco Muishout <Ma...@thecomputer.nl> on 2003/12/11 00:18:59 UTC

WebappClassLoader getURL vs. Performance Problems

Hi,

We are using a web application running in Tomcat 4.1.24 (JDK 1.3.1), on
HP-UX. This web application uses an rmi server to connect to oracle. We
experience serious performance problems when we are using this application
in this mode. It seems that tomcat is very busy. We used profiling to
analyze what Tomcat is doing.

It seems that Tomcat spends about 50% of its time in the following method:

org.apache.catalina.loader.WebappClassLoader.getURL()

The profiler shows us that this method is called only 4 times!

Does anyone have an explanation why this method consumes so much time? We
had a look in the source code and we saw this:

    protected URL getURL(File file)
        throws MalformedURLException
    {
        File realFile = file;
        try
        {
            realFile = realFile.getCanonicalFile();
        }
        catch(IOException e) { }
        return realFile.toURL();
    }


Could it be that we have an IOException? Why is this exception ignored?

Feedback is highly appreciated..!

Marco




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


Re: WebappClassLoader getURL vs. Performance Problems

Posted by Remy Maucherat <re...@apache.org>.
Marco Muishout wrote:
> Hi,
> 
> We are using a web application running in Tomcat 4.1.24 (JDK 1.3.1), on
> HP-UX. This web application uses an rmi server to connect to oracle. We
> experience serious performance problems when we are using this application
> in this mode. It seems that tomcat is very busy. We used profiling to
> analyze what Tomcat is doing.
> 
> It seems that Tomcat spends about 50% of its time in the following method:
> 
> org.apache.catalina.loader.WebappClassLoader.getURL()
> 
> The profiler shows us that this method is called only 4 times!
> 
> Does anyone have an explanation why this method consumes so much time? We
> had a look in the source code and we saw this:
> 
>     protected URL getURL(File file)
>         throws MalformedURLException
>     {
>         File realFile = file;
>         try
>         {
>             realFile = realFile.getCanonicalFile();
>         }
>         catch(IOException e) { }
>         return realFile.toURL();
>     }
> 
> 
> Could it be that we have an IOException? Why is this exception ignored?
> 
> Feedback is highly appreciated..!

I think I know (are you really sure about the invocation count ? this 
looks very suspicious). If getURLs() is called all the time (I think RMI 
uses that), then getURL will get called a lot (and getCanonicalFile is 
very expensive). The URL array needs to be cached (you should try to 
patch your Tomcat).

Rémy



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