tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cowwoc <>
Subject Re: One process per webapp
Date Tue, 14 Jun 2011 22:05:13 GMT

Christopher Schultz-2 wrote:
> Can't Netbeans bounce the Tomcat JVM for you?

Sure, but if we use the existing mechanism of waiting for for the existing
instance to shut down before restarting it then it takes at least 20 seconds
each time. I'm looking for a second or less.

Christopher Schultz-2 wrote:
> If this is just in development, why not just wrap System.loadLibrary()
> in a try/catch block and ignore the exception you get when re-loading
> the native library?
> This just seems like it would be a lot of work for not much gain.

Because once you get this exception (whether you ignore it or not) you can
no longer invoke any of the native methods (they will throw their own
exceptions). Essentially, the reload operation has failed.

Christopher Schultz-2 wrote:
> With no webapps deployed at all? Wow, something is not right. Are you
> sure you have enough memory installed on your dev instance?
>> Starting
>> up a new instance is fairly quick. Shutting down takes a while.
> That seems strange... do you have a complicated shutdown procedure for
> your webapp? Tomcat shuts down on my end in very short order when no
> webapps need to be undeployed.

I don't think you and I are measuring the same thing. Tomcat loads up in
under 2 seconds, but it takes over 8 seconds to shut down. It is quite
possible that the Netbeans plugin is injecting a sleep() somewhere but I'm
not sure. I know they have a 5 second sleep for the Glassfish plugin. I'm
guessing they had a good reason for adding those calls though. Does Tomcat
provide hooks for integrators to know that the webapp is fully unloaded? How
long does a restart (without a webapp) take on your end?

Christopher Schultz-2 wrote:
>> When restarting a webapp, we don't have to wait for the old instance to
>> finish shutting down (which is slow) before transferring access to
>> another
>> Tomcat instance.
> If they're going to be using the same port, you do.

They wouldn't use the same port.

Christopher Schultz-2 wrote:
>> The new instance can simply bind to a different port and
>> the proxy running at port 80 can switch which port it is redirecting
>> requests to.
> So... you want Tomcat to also notify a 3rd-party that it's being shut
> down so that a proxy can re-configure itself?

No. I would ask the proxy (which would be part of Tomcat) to restart an
instance on my behalf. It would do the necessary communication with the
instance to request a shutdown and listen for lifecycle events.

Christopher Schultz-2 wrote:
>> The only snag I can think of is that the old instance might
>> keep files locked on disk (but I think this is no longer the case with
>> Tomcat 7.x)
> I don't believe Tomcat locks anything specific. Under certain
> situations, the JVM and the OS conspire to lock certain resources
> (usually .jar files) and that can be a problem.
> If you're starting a new instance in parallel, wouldn't you want to do
> it from a separate directory anyway?

Good point. We could do that.

View this message in context:
Sent from the Tomcat - User mailing list archive at

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

View raw message