comparison src/http/ngx_http_upstream_round_robin.h @ 4207:4fc91bae6f83

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 12 Oct 2011 14:22:48 +0000
parents ebcee0063cd8
children d620f497c50f
comparison
equal deleted inserted replaced
4206:1a94a56a4e5d 4207:4fc91bae6f83
21 ngx_int_t current_weight; 21 ngx_int_t current_weight;
22 ngx_int_t weight; 22 ngx_int_t weight;
23 23
24 ngx_uint_t fails; 24 ngx_uint_t fails;
25 time_t accessed; 25 time_t accessed;
26 time_t checked;
26 27
27 ngx_uint_t max_fails; 28 ngx_uint_t max_fails;
28 time_t fail_timeout; 29 time_t fail_timeout;
29 30
30 ngx_uint_t down; /* unsigned down:1; */ 31 ngx_uint_t down; /* unsigned down:1; */