Error handling of "Connection refused" conditions

Reinis Rozitis r at
Wed Jun 20 19:04:15 UTC 2012

> I am using nginx to distribute http load across three upstream application 
> servers. It actually works really well in normal usage, but when we 
> restart one of the upstream servers for maintenance (such as for an OS 
> update), nginx tends to hang incoming requests for some time (30 seconds 
> or more). When a node is brought offline, the nginx error logs show a few 
> messages like this:

You should probably post the relevant parts of your configuration since 
there are quite few parameters to tune nginx for a better responsiveness.

To name a few: proxy_connect_timeout, proxy_read_timeout, proxy_send_timeout 
which by default are 60 seconds (what could explain your "hanging" 
requests), lowering those allows 'proxy_next_upstream' (by default - timeout 
and error) kick in sooner so the backend changes/restarts are seemless and 
don't really affect the end-users so much.


More information about the nginx mailing list