]> git.kaiwu.me - nginx.git/commit
Better recheck of dead upstream servers.
authorMaxim Dounin <mdounin@mdounin.ru>
Wed, 12 Oct 2011 14:22:48 +0000 (14:22 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Wed, 12 Oct 2011 14:22:48 +0000 (14:22 +0000)
commitb713e480ca9aeccaf63bccf8629eec13041c6ab6
tree8e2715dced608b399c3a4d7157bee7519e4380f9
parent72df0f400a4f6144f9c69add91002a0ff02cfe41
Better recheck of dead upstream servers.

Previously nginx used to mark backend again as live as soon as fail_timeout
passes (10s by default) since last failure.  On the other hand, detecting
dead backend takes up to 60s (proxy_connect_timeout) in typical situation
"backend is down and doesn't respond to any packets".  This resulted in
suboptimal behaviour in the above situation (up to 23% of requests were
directed to dead backend with default settings).

More detailed description of the problem may be found here (in Russian):
http://mailman.nginx.org/pipermail/nginx-ru/2011-August/042172.html

Fix is to only allow one request after fail_timeout passes, and
mark backend as "live" only if this request succeeds.

Note that with new code backend will not be marked "live" unless "check"
request is completed, and this may take a while in some specific workloads
(e.g. streaming).  This is believed to be acceptable.
src/http/modules/ngx_http_upstream_ip_hash_module.c
src/http/ngx_http_upstream_round_robin.c
src/http/ngx_http_upstream_round_robin.h