Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat 8 Slow startup with deployWAR

I went from Tomcat 7.0.54 to 8.0.15, upgraded openSSL to 1.0.1k and tcnative to the latest 1.1.32 with APR 1.5.1.

However, Tomcat now starts about 2 to 3 times slower than before. Most noticeably, it takes alot longer to deploy WAR files.

Tomcat 7

Jan 20, 2015 3:39:36 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive <PATH>\file.war has finished in 433 ms

Tomcat 8

Jan 21, 2015 2:27:01 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive <PATH>\file.war has finished in 4,310 ms

This happens to all WAR files, all went from milliseconds to around 5 seconds.

I removed the JasperListener from the server.xml because it appears to have been removed.

unpackWARs="false"
autoDeploy="true"

unpackWars does not make a difference if set to true (atleast not noticable). I thought it might have been the annotation scanning issue fixed in 8.0.17, but no luck.

I noticed that jarsToSkip in catalina.properties changed from

tomcat.util.scan.DefaultJarScanner.jarsToSkip to
tomcat.util.scan.StandardJarScanFilter.jarsToSkip

and that org.apache.catalina.startup.TldConfig.jarsToSkip was removed and went to context.xml

<JarScanner>
    <JarScanFilter tldSkip="websocket-api.jar,tomcat-websocket.jar"/>
</JarScanner>

However, none of this seems to bring me back to the performance of tomcat 7. The one action that did do it, was removing the websocket jars. However we need them. This brings me to the conclusion that they are still scanned, even though they should be skipped.

Am I missing something? Does the context.xml not do the same as the catalina.properties jarsToSkip?

like image 815
RavenLiquid Avatar asked Jan 26 '15 10:01

RavenLiquid


People also ask

Why does Tomcat take so long to start?

If your Tomcat takes longer to start, it may be due to the random number generator that it is using. You might want to consider forcing it to use '/dev/urandom' rather than the default '/dev/random' that Tomcat uses.

Why is Tomcat so slow?

For Tomcat itself to run slow would mean that the VM it's running in was severely starved for resources. So, for example, if Tomcat is running slow, you should check to make sure that the machine that Tomcat is running on has enough physical RAM that it isn't thrashing virtual memory.


1 Answers

The solution for slow startup in general for me was to put in conf/context.xml:

<Context>
    <JarScanner>
        <JarScanFilter defaultPluggabilityScan="false" />
    </JarScanner>
</Context> 

Source: https://groups.google.com/a/apereo.org/forum/#!topic/sakai-dev/cjtYGxd6hG0

like image 72
misterti Avatar answered Sep 20 '22 17:09

misterti