Welcome! Log In Create A New Profile

Advanced

[BUG?]fail_timeout/max_fails: code doesn't do what doc says

Dmitry Popov
May 19, 2013 06:10PM
Hi.

http://wiki.nginx.org/HttpUpstreamModule says
max_fails = NUMBER - number of unsuccessful attempts at communicating with the
server within the time period (assigned by parameter fail_timeout) after which
it is considered inoperative ...
fail_timeout = TIME - the time during which must occur *max_fails* number of
unsuccessful attempts at communication with the server that would cause the
server to be considered inoperative ...

However, as we may see from code (ngx_http_upstream_get_peer and
ngx_http_upstream_free_round_robin_peer
from src/http/ngx_http_upstream_round_robin.c) the logic is not as described:
(simplified code)
get_peer:
if (fails >= max_fails && now <= fail_timeout + checked)
skip
...
checked = now
free_peer:
if (request_failed)
fails++
accessed = now
checked = now
else
if (accessed < checked)
fails = 0

1) So, fail_timeout is never used while peer is gaining fails (until
fails >= max_fails);
2) This algorithm always resets fails count if first request inside new second
succeeds; it always increases fails count if first request fails. So, a lot
depends on first (inside a second) request; I don't think it's a desired
behaviour.
3) I'm not sure if "accessed" is a good name for a field that contains last
fail timestamp.

I don't know where an error is (in doc or code) and I don't know how you (nginx
devs) wanted it to work so I don't have any constructive ideas, sorry.

--
Dmitry Popov
Highloadlab

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[BUG?]fail_timeout/max_fails: code doesn't do what doc says

Dmitry Popov 829 May 19, 2013 06:10PM

Re: [BUG?]fail_timeout/max_fails: code doesn't do what doc says

Maxim Dounin 401 May 20, 2013 01:12PM

Re: [BUG?]fail_timeout/max_fails: code doesn't do what doc says

Dmitry Popov 445 May 21, 2013 08:20AM

Re: [BUG?]fail_timeout/max_fails: code doesn't do what doc says

Dmitry Popov 380 May 21, 2013 08:48AM

Re: [BUG?]fail_timeout/max_fails: code doesn't do what doc says

Maxim Dounin 535 May 21, 2013 09:24AM

Re: [BUG?]fail_timeout/max_fails: code doesn't do what doc says

Dmitry Popov 422 May 21, 2013 09:56AM

Re: [BUG?]fail_timeout/max_fails: code doesn't do what doc says

Maxim Dounin 450 May 22, 2013 12:58PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 196
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready