Error handling of "Connection refused" conditions

Reinis Rozitis r at roze.lv
Wed Jun 20 20:58:11 UTC 2012


> Is it considered good practice to reduce proxy_connect_timeout to some 
> small value if responsiveness during an outage is desired?

It depends on the nature of the (backend) software and the network 
infrastucture/latency -  the closer the servers (network-wise) and the 
higher throughput of the application the lower you can/should set it.

There is also a general observation/standard or apdex (Application 
Performance Index) that average web-user starts to become "unsatisfied" if 
the request takes more than 1-2 seconds so using the default 60 seconds (in 
case of some backend failure) to deliver the content makes no sense - the 
user will sooner hit refresh / just close the browsers (go to another site) 
or fall in panic than wait for anything to load.


On the other hand making nginx immideatly close and switch to another 
backend isnt always the (best) solution - especially if the backends do some 
long running computations and/or accept only limited number of connections. 
This way quickly cycling through all backends won't serve a good response at 
all what matters if you have an extra caching layer above (to fetch a valid 
object (html/image etc)) or some sort of transactions (like payment systems) 
which just take time and each request is important.


I usually set it to 2-3 seconds.
That way I can also indicate if the backends perform well enough and react 
if a new bottleneck arises - the application code, underlaying 
DBs/filesystems start to get too slow.


rr 



More information about the nginx mailing list