You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Antonio Parolini <An...@hcuge.ch> on 2008/07/04 09:54:21 UTC

Graceful shutdown

Hello,

We use Tomcat 5.5.23

Using the command "catalina.sh stop" interrupts abruptly any working servlet
threads and stop Tomcat. 

Is there a way of shutting tomcat gracefully?

For me, an example of graceful shutdown would be:
1) The HTTP connector stop accepting new requests
2) Tomcat wait that all the servlet threads finish (without interrupting
them as it does today)
3) Shutdown the server

Thanks for your advises,

Antonio

NB: I've seen that jk2 connector did something about this, but we are not
using Apache as our front end.
-- 
View this message in context: http://www.nabble.com/Graceful-shutdown-tp18274673p18274673.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Graceful shutdown

Posted by Ben Stringer <be...@burbong.com>.
On Mon, 2008-07-07 at 00:10 -0700, Antonio Parolini wrote:
> Hi, Ben
> 
> > 1) Define a status worker [1] and one (or more) workers.
> 
> Interresting.  Will this status worker thing work -without- a webserver as
> Frontend (like Apache) ?

Hi Antonio,

No, to the best of my knowledge, you need to be running a webserver in
front of tomcat to use this method.

> 
> I'm looking now into the use of JMX to solve this issue, by  trying to block
> new HTTP requests using the /manager/jmxproxy/ before shuting down the
> server.

Sounds interesting - please post to the list if you get this working.
I'd be interested to hear the details.

Cheers, Ben

> 
> -antonio
> 
> 
> 
> 
> 


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


Re: Graceful shutdown

Posted by Antonio Parolini <An...@hcuge.ch>.
Hi, Ben

> 1) Define a status worker [1] and one (or more) workers.

Interresting.  Will this status worker thing work -without- a webserver as
Frontend (like Apache) ?

I'm looking now into the use of JMX to solve this issue, by  trying to block
new HTTP requests using the /manager/jmxproxy/ before shuting down the
server.

-antonio





-- 
View this message in context: http://www.nabble.com/Graceful-shutdown-tp18274673p18311209.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: Graceful shutdown

Posted by Ben Stringer <be...@burbong.com>.
On Fri, 2008-07-04 at 00:54 -0700, Antonio Parolini wrote:
> Hello,
> 
> We use Tomcat 5.5.23
> 
> Using the command "catalina.sh stop" interrupts abruptly any working servlet
> threads and stop Tomcat. 
> 
> Is there a way of shutting tomcat gracefully?
> 
> For me, an example of graceful shutdown would be:
> 1) The HTTP connector stop accepting new requests
> 2) Tomcat wait that all the servlet threads finish (without interrupting
> them as it does today)
> 3) Shutdown the server
> 
> Thanks for your advises,
> 
> Antonio
> 
> NB: I've seen that jk2 connector did something about this, but we are not
> using Apache as our front end.

Hi Antonio,

I researched a method to do this some time ago, using Apache httpd with
mod_jk. The goal was to be able to run multiple tomcat instances (load
balanced, but not clustered) and be able to take single instances down
with no end-user impact. It was roughly along these lines:

1) Define a status worker [1] and one (or more) workers.
2) When you wish to shut down a tomcat instance, use the status worker
to quiesce the worker for the tomcat instance you are stopping. I don't
recall the exact status that needs to be used here, but I believe there
was one that would result in no new sessions being established on a
worker, but existing sessions are able to proceed.
3) Monitor the worker traffic to see when the remaining sessions
appears to have ceased.
4) Stop the tomcat instance.

However when we tried to implement this setup, it did not work quite as
expected.

Cheers, Ben


[1] http://tomcat.apache.org/connectors-doc/reference/status.html


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