You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christos Karras <ck...@capella.org> on 2002/09/05 19:13:34 UTC

load-on-startup's effect on tomcat startup time?

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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: load-on-startup order seems incorrect...

Posted by Andy Eastham <an...@gliant.com>.
Jeff,

Try 10 and 20 or 1 and 2.

I know negative numbers don't necessarily start up before 1, maybe 0 doesn't
either.

Andy

> -----Original Message-----
> From: Jeff Wishnie [mailto:jeff@deluxebiz.com]
> Sent: 05 September 2002 18:22
> To: Tomcat Users List
> Subject: load-on-startup order seems incorrect...
>
>
> I have two load-on-startup servlets in my apps web.xml . One is set as 0,
> the other as 1.
>
> According the the servlet spec, containers should guarantee that servlet's
> with lower load-on-startup values should load first, but according to my
> logs, Servlet 1 gets its init called before servlet 0.
>
> I'm using Tomcat 4.1.7 on Redhat 7.2
>
> Any idea why the load is happening in the reverse order?
>
> Thanks,
>
> jeff
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


load-on-startup order seems incorrect...

Posted by Jeff Wishnie <je...@deluxebiz.com>.
I have two load-on-startup servlets in my apps web.xml . One is set as 0,
the other as 1.

According the the servlet spec, containers should guarantee that servlet's
with lower load-on-startup values should load first, but according to my
logs, Servlet 1 gets its init called before servlet 0.

I'm using Tomcat 4.1.7 on Redhat 7.2

Any idea why the load is happening in the reverse order?

Thanks,

jeff


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>