Hi,

we used to deploy our webapp in a tomcat 6.0.35 and want to upgrade to tomcat 
8.0.9.
During testing we discovered, that the startup process of tomcat 8 is twice as 
long as the startup process of tomcat 6 (with the same single webapp deployed)

My test system is as follows:
Windows 7, JRE 1.7.0, Tomcat 6.0.35/8.0.9

Inspection of the log files revealed, that the additional time is used for 
class loading:

Log of tomcat 6:
...
Nov 28, 2014 5:07:59 PM org.apache.tomcat.util.digester.Digester endDocument
Fein: endDocument()
Nov 28, 2014 5:07:59 PM org.apache.catalina.loader.WebappClassLoader loadClass
Fein: loadClass(org.springframework.web.util.Log4jConfigListener, false)
...
Fein: Parent class loader is: WebappClassLoader
context:
delegate: false
repositories:
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@189ff97
Nov 28, 2014 5:08:08 PM org.apache.jasper.compiler.JspRuntimeContext 
initClassPath
Fein: Compilation classpath initialized: ...
Nov 28, 2014 5:08:08 PM org.apache.jasper.servlet.JspServlet init
Fein: Scratch dir for the JSP engine is: ...
Nov 28, 2014 5:08:08 PM org.apache.jasper.servlet.JspServlet init
Fein: IMPORTANT: Do not modify the generated servlets
Nov 28, 2014 5:08:08 PM org.apache.catalina.core.StandardContext start
Fein: Starting completed
...
Nov 28, 2014 5:08:09 PM org.apache.catalina.startup.Catalina start
Information: Server startup in 10861 ms

Log of tomcat 8:
...
28-Nov-2014 16:09:09.128 FINER [localhost-startStop-1] 
org.apache.tomcat.util.scan.StandardJarScanner.scan Not scanning JAR 
[file:/C:/Program%20Files/tomcat%208/tolina_webserver-3.0.0-SNAPSHOT-20141103-130423/bin/tomcat-juli.jar]
 from classpath
28-Nov-2014 16:09:09.128 FINE [localhost-startStop-1] 
org.apache.catalina.loader.WebappClassLoader.loadClass 
loadClass(org.apache.jasper.servlet.JasperInitializer, false)
28-Nov-2014 16:09:09.128 FINE [localhost-startStop-1] 
org.apache.catalina.loader.WebappClassLoader.loadClass Delegating to parent 
classloader1 java.net.URLClassLoader@1c47dd5
28-Nov-2014 16:09:09.128 FINE [localhost-startStop-1] 
org.apache.catalina.loader.WebappClassLoader.loadClass Loading class from parent
...
28-Nov-2014 16:09:28.362 FINE [localhost-startStop-1] 
org.apache.jasper.compiler.JspRuntimeContext.<init> Parent class loader is: 
WebappClassLoader
context: /manager
delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@1c47dd5
28-Nov-2014 16:09:28.362 FINE [localhost-startStop-1] 
org.apache.jasper.compiler.JspRuntimeContext.initClassPath Compilation 
classpath initialized: ...
28-Nov-2014 16:09:28.362 FINE [localhost-startStop-1] 
org.apache.jasper.servlet.JspServlet.init Scratch dir for the JSP engine is: ...
28-Nov-2014 16:09:28.362 FINE [localhost-startStop-1] 
org.apache.jasper.servlet.JspServlet.init IMPORTANT: Do not modify the 
generated servlets
28-Nov-2014 16:09:28.362 FINE [localhost-startStop-1] 
org.apache.tomcat.util.modeler.Registry.registerComponent Managed= 
Catalina:type=JspMonitor,WebModule=//localhost/manager,name=jsp,J2EEApplication=none,J2EEServer=none
28-Nov-2014 16:09:28.362 FINE [localhost-startStop-1] 
org.apache.tomcat.util.modeler.BaseModelMBean.preRegister preRegister 
org.apache.jasper.servlet.JspServlet@1067d4c 
Catalina:type=JspMonitor,WebModule=//localhost/manager,name=jsp,J2EEApplication=none,J2EEServer=none
28-Nov-2014 16:09:28.362 FINE [localhost-startStop-1] 
org.apache.catalina.core.StandardContext.startInternal Starting completed
28-Nov-2014 16:09:28.362 FINE [localhost-startStop-1] 
org.apache.catalina.util.LifecycleBase.setStateInternal Setting state for 
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/manager]] to 
[STARTING]
28-Nov-2014 16:09:28.362 FINE [localhost-startStop-1] 
org.apache.catalina.util.LifecycleBase.setStateInternal Setting state for 
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/manager]] to 
[STARTED]
...
28-Nov-2014 16:09:28.377 FINE [main] 
org.apache.catalina.util.LifecycleBase.setStateInternal Setting state for 
[StandardServer[8005]] to [STARTED]
28-Nov-2014 16:09:28.377 INFO [main] org.apache.catalina.startup.Catalina.start 
Server startup in 21443 ms

Searching the web and the mail archives resulted in quite a few hints how to 
improve performance generally.
I followed the instructions on wiki.apache.org/tomcat/HowTo/FasterStartUp, in 
particular:
- Disabling JAR scanning (metadata-complete="true", <absolute-ordering/> in the 
<web-app>.
- in catalina.properties:
tomcat.util.scan.StandardJarScanFilter.jarsToSkip=\*.jar
org.apache.catalina.startup.ContextConfig.jarsToSkip=\*.jar
org.apache.catalina.startup.TldConfig.jarsToSkip=\*.jar
- Removing the web socket API and implementation JARs
- Changing the entropy source (-Djava.security.egd=file:/dev/./urandom)

These changes were in effect when the above logs were written. While these 
changes resulted in a faster startup process (on both tomcats), I found no clue 
about why tomcat 8 takes longer in general to complete server startup.

I compared the jars loaded in both cases and tried to remove the two additional 
jars in tomcat 8.
I compared the configurations of both tomcats and aligned the registered 
listeners and disabled XMLValidation and XMLNameSpaceAware in server.xml. I 
reduced the bigger MIME-Mapping in web.xml of tomcat 8
to the MIME-Mapping of tomcat 6.
I compared the number of classes and ressources loaded and the number of 
ClassNotFound- or RessourceNotFound-Messages in the log files.

None of these actions resulted in new insights to the problem.

Any advice on this subject or any hint to additional ressources that could help 
would be appreciated very much.

Best regards,
Gero

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

Reply via email to