Tomcat cluster behind nginx: avoiding delays while restarting tomcat

Michael Shadle mike503 at
Wed May 27 12:08:31 MSD 2009

On Wed, May 27, 2009 at 12:59 AM, John Morris <jman at> wrote:

> When starting or restarting tomcat, our web application takes a couple of
> minutes to initialize, during which time the tomcat connector is listening
> on TCP 8080, but the application isn't ready to process requests.

This is one example of "healthchecks" that would make nginx more
robust for doing load balancing. I've got it on my wishlist :)

I think most people will say make a healthcheck script that updates an
nginx include config file with the list of upstreams and then HUP

> - Write a script to edit nginx.conf, mark the tomcat node as 'down', and
> reload nginx;

I'd say make it an include. That way less stuff to go through :P (see above)

> - Or, write a script to run on the tomcat server using iptables to REJECT
> connections to TCP 8080 until the app is finished initializing.

This is an interesting approach, never thought about doing it on the
upstream itself. Kind of cool, actually. "Am I ready for requests?"

More information about the nginx mailing list