You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Robert Olofsson <ro...@digpro.se> on 2013/11/21 14:20:46 UTC

Tomcat slow during startup >= 7.0.28

Hi!

I have tried to upgrade our system to more modern tomcat (from 7.0.28) to
7.0.47 and we also get the slow startup due to annotations processing.
In my case it makes tomcat startup go from < 1 second to ~8 seconds and
for development that is annoying, even if it is not critical for 
production servers.
This system has ROOT+one webapp. The webapp is not very large, but there 
are
350 jars in WEB-INF/lib.

Setting metadata-complete="true" has very little affect (it shaves of 
about 0.5
seconds)

As I understand it this has been a known problem since january, anyone know
if there is an open bug on it or a plan to fix it?

Is there any suggestions on what to do more to get a faster startup?

Thread dumps all look like this:
"localhost-startStop-1" daemon prio=10 tid=0x00007f713c003800 nid=0x1d2e 
runnable [0x00007f7147a9f000]
    java.lang.Thread.State: RUNNABLE
     at java.lang.Object.<init>(Object.java:37)
     at java.io.InputStream.<init>(InputStream.java:45)
     at java.util.zip.ZipFile$ZipFileInputStream.<init>(ZipFile.java:657)
     at java.util.zip.ZipFile.getInputStream(ZipFile.java:354)
     - locked <0x00000007ad535b70> (a sun.net.www.protocol.jar.URLJarFile)
     at java.util.jar.JarFile.getInputStream(JarFile.java:409)
     - locked <0x00000007ad535b70> (a sun.net.www.protocol.jar.URLJarFile)
     at 
org.apache.tomcat.util.scan.FileUrlJar.getEntryInputStream(FileUrlJar.java:97)
     at 
org.apache.catalina.startup.ContextConfig.processAnnotationsJar(ContextConfig.java:2009)
     at 
org.apache.catalina.startup.ContextConfig.processAnnotationsUrl(ContextConfig.java:1976)
     at 
org.apache.catalina.startup.ContextConfig.processAnnotations(ContextConfig.java:1961)
     at 
org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1319)
     at 
org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
     - locked <0x00000007b4d77a70> (a 
org.apache.catalina.startup.ContextConfig)
     at 
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
     at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
     at 
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
     at 
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322)
     - locked <0x00000007b4d77570> (a 
org.apache.catalina.core.StandardContext)
     at 
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
     - locked <0x00000007b4d77570> (a 
org.apache.catalina.core.StandardContext)
     at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
     at 
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
     at 
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
     at 
org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:663)
     at 
org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1642)
     at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
     at java.util.concurrent.FutureTask.run(FutureTask.java:166)
     at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
     at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
     at java.lang.Thread.run(Thread.java:722)

Thanks!
/robo

Re: Tomcat slow during startup >= 7.0.28

Posted by Konstantin Kolinko <kn...@gmail.com>.
2013/11/21 Robert Olofsson <ro...@digpro.se>:
>
> On 11/21/2013 03:17 PM, Mark Thomas wrote:
>>
>> You appear to be complaining about specification mandated behaviour. The
>> scan is required as soon as there is an SCI that declares an interest in
>> a class.
>
> As far as I know we do not use any such thing.
> We do use two ServletContextListener and from the stack trace they
> could be the problem. Both of them are in web.xml,
>
> Is there some log I can turn on to figure out why this scan is happening?
>
>> One might equally ask if you have any plans to fix your poorly
>> configured application.
>
> Well, perhaps the application is poorly configured, but there is still
> a major change in startup time from one release to the next in the same
> major version and I would consider that a regression.
>
>> Use <absolute-ordering /> since that will exclude every JAR from the
>> annotation scan for matches to the SCIs.
>
> That seems to bring me down to less than one second again.
> I will test that some more and see what breaks.
>

I updated the following page:
http://wiki.apache.org/tomcat/HowTo/FasterStartUp

You may find it useful.

Best regards,
Konstantin Kolinko

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


Re: Tomcat slow during startup >= 7.0.28

Posted by Robert Olofsson <ro...@digpro.se>.
On 11/21/2013 03:17 PM, Mark Thomas wrote:
> You appear to be complaining about specification mandated behaviour. The
> scan is required as soon as there is an SCI that declares an interest in
> a class.
As far as I know we do not use any such thing.
We do use two ServletContextListener and from the stack trace they
could be the problem. Both of them are in web.xml,

Is there some log I can turn on to figure out why this scan is happening?
> One might equally ask if you have any plans to fix your poorly
> configured application.
Well, perhaps the application is poorly configured, but there is still
a major change in startup time from one release to the next in the same
major version and I would consider that a regression.
> Use <absolute-ordering /> since that will exclude every JAR from the
> annotation scan for matches to the SCIs.
That seems to bring me down to less than one second again.
I will test that some more and see what breaks.

Thanks!
/robo


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


Re: Tomcat slow during startup >= 7.0.28

Posted by Mark Thomas <ma...@apache.org>.
On 21/11/2013 13:20, Robert Olofsson wrote:
> Hi!
> 
> I have tried to upgrade our system to more modern tomcat (from 7.0.28) to
> 7.0.47 and we also get the slow startup due to annotations processing.
> In my case it makes tomcat startup go from < 1 second to ~8 seconds and
> for development that is annoying, even if it is not critical for
> production servers.
> This system has ROOT+one webapp. The webapp is not very large, but there
> are
> 350 jars in WEB-INF/lib.
> 
> Setting metadata-complete="true" has very little affect (it shaves of
> about 0.5
> seconds)
> 
> As I understand it this has been a known problem since january, anyone know
> if there is an open bug on it or a plan to fix it?

You appear to be complaining about specification mandated behaviour. The
scan is required as soon as there is an SCI that declares an interest in
a class.

One might equally ask if you have any plans to fix your poorly
configured application.

> Is there any suggestions on what to do more to get a faster startup?

Use <absolute-ordering /> since that will exclude every JAR from the
annotation scan for matches to the SCIs.

If you need the SCI scan for some of the JARs you'll have to work with
Tomcat's tomcat.util.scan.DefaultJarScanner.jarsToSkip property.

Mark


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