tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christos Karras <>
Subject load-on-startup's effect on tomcat startup time?
Date Thu, 05 Sep 2002 17:13:34 GMT
I use the <load-on-startup> tag in web.xml to call a servlet when its
context is started. The servlet's init() reads a configuration file and
stores the configuration as a singleton object in the ServletContext.

I first thought this was a good idea, so that the user doesn't see the 2
or 3 seconds it takes to parse the file when a servlet is first called
in the context.

Now I use a similar method for 5 differents web apps, and it seems to
have an effect on tomcat's startup time.

If I understand the startup process correctly, this is what happens:
- tomcat reads its server.xml
- tomcat initializes all contexts defined in server.xml, loading any
load-on-startup servlet for each context
- then, only once all contexts are initialized, it opens connectors
(HttpConnector, Ajp13Connector...)

So now a user has to wait for ALL contexts to have been initialized
before getting a response to a servlet call.

If I remove the <load-on-startup> instruction in all the web.xml files,
tomcat starts responding to requests much faster, but the first client
to request a servlet on each context has a 2 seconds delay before his
request is answered.

Is my understanding of the startup process right? Would there be a way
to avoid waiting for <load-on-startup> servlets to be loaded before
opening an HttpConnector, but still having the servlet initialized
before a clients makes a first request?

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message