tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ron McNulty" <rmcnu...@xtra.co.nz>
Subject Re: very slow class loading on initial JSP/servlet request after restart
Date Fri, 20 Feb 2009 05:41:38 GMT
Hi Sam

You jar - does it include any JSP tag files written as JSP fragments? There 
are known issues in this area. The dependency management seems to get 
confused, resulting in lots of unnecessary compilation of the .tag files

Regards

Ron

----- Original Message ----- 
From: "Sam Hokin" <sam@ims.net>
To: <users@tomcat.apache.org>
Sent: Friday, February 20, 2009 12:23 PM
Subject: very slow class loading on initial JSP/servlet request after 
restart


> I've been struggling with a very severe problem on one of my three Tomcat 
> servers since late December.  I'm completely stumped.  I'm running 6.0.18 
> on all three servers, which are all running Fedora Core 9, all currently 
> running Sun's JDK 1.6.0_12.  The only difference is hardware.  The server 
> that's being a problem is a Dell PowerEdge 1950, quad dual core. All three 
> servers are configured exactly the same, with Apache HTTPD and using 
> mod_proxy_ajp to pass requests on to Tomcat's AJP connector.  All Tomcat 
> instances are running the tomcat-native APR v1.1.14 that comes bundled 
> with Tomcat. However, this problem persists on the problematic server if I 
> don't run tomcat-native APR.
>
> The problem, which spontaneously appeared a few days before Christmas on 
> this one server, is that the initial request of a JSP or servlet takes 
> AGES to respond, usually exceeding several minutes.  I've found that 
> compilation of a JSP to a class file is nearly instant, but response from 
> the resulting compiled class takes forever.  Further, I found that this 
> only happens when the offending JSP (or servlet) imports classes that I 
> wrote, located in a JAR in Tomcat's /lib directory or inside the web app's 
> WEB-INF/lib directory, or expanded out under WEB-INF/classes.  For 
> example, the following simple JSP,
>
> <%@ page import="java.util.*, java.io.*, net.ims.jcms.*" %>
> <%
> java.util.Date endDate = new java.util.Date();
> out.println(endDate.toString());
> %>
>
> takes AGES to respond, the first time it is requested after a Tomcat 
> restart (even if the compiled class is present under the /work tree), 
> while another JSP with the same executable lines:
>
> <%@ page import="java.util.*, java.io.* %>
> <%
> java.util.Date endDate = new java.util.Date();
> out.println(endDate.toString());
> %>
>
> responds immediately.  The net.ims.jcms package is something I wrote. 
> After the first time a JSP has been requested, subsequent requests respond 
> immediately.  So, the server still functions, but there is a horribly long 
> delay before pages respond after a Tomcat restart.
>
> Again, this is not a compilation issue; I've monitored the /work directory 
> and can see that the class files appear very quickly.  In addition, this 
> problem recurs after a Tomcat restart when the compiled class files 
> already exist under /work.  I've run the JVM with the -verbose:class 
> option, and, sure enough, the long delay corresponds to a long delay 
> before the page's class is loaded by the JVM.  As soon as the JVM spits 
> out the line saying it loaded the class, the response is sent.
>
> So, my conclusion is that the class loader simply takes a very long time, 
> on the first request, if the class imports the package that I wrote. 
> After the class is loaded into memory by that first request, subsequent 
> requests respond normally.
>
> I cannot divine any problem with my JAR file or classes within it that 
> would result in this problem; furthermore, it only occurs on one of three 
> servers running the exact same everything.  I have run MEMTEST86 on the 
> offending server and memory seems to be fine.  It is fine for all other 
> services, processes, etc.  The problem is robust on this specific server - 
> it has transcended versions of Tomcat, the JVM, the kernel version, etc.
>
> I would greatly appreciate any suggestions for further diagnostics, things 
> to try, offending things I may have done in my Java package, etc.  Thanks!
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message