Nginx – Apache or Nginx equivalent to the IIS “drain stop”

apache-2.2iisnginxtomcat

I come from a .NET background and there are many things I loved about it along side many things I hated. IIS was, in general, one of those things I hated.

However, one really nice feature of IIS was that you could put a "drain stop" on your server node. This would redirect all new traffic to other nodes but allow users currently online to finish out their sessions before shutting down IIS completely.

This was exceptionally handy for doing deployments without interrupting user sessions.

At my new company, we're not .NET and loving it. We're working in JRuby and Java on EC2 using Apache as a front-end and Tomcat as our back-end.

Has anyone ever run across any solution that provides similar functionality with Tomcat, Nginx, or Apache?

I've done some searching but was unable to come up with anything useful. How about Axis2? Does anyone have any experience with that?

Best Answer

If you want to shutdown the local apache site letting the current users finish their current task do a graceful Apache stop. I'll presume that you have some other architecture that would redirect users to another operational website to allow them to continue (i.e. load balancer, etc).

From the Apache site:

Signal: WINCH apachectl -k graceful-stop

" The WINCH or graceful-stop signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they're not serving anything). The parent will then remove its PidFile and cease listening on all ports. The parent will continue to run, and monitor children which are handling requests. Once all children have finalised and exited or the timeout specified by the GracefulShutdownTimeout has been reached, the parent will also exit. If the timeout is reached, any remaining children will be sent the TERM signal to force them to exit.

A TERM signal will immediately terminate the parent process and all children when in the "graceful" state. However as the PidFile will have been removed, you will not be able to use apachectl or httpd to send this signal. "