Welcome! Log In Create A New Profile

Advanced

ngx_http_upstream_test_next u->peer.tries > 1

Posted by crasyangel 
crasyangel
ngx_http_upstream_test_next u->peer.tries > 1
November 24, 2017 09:30AM
assume all servers always fail in upstream

nginx would call ngx_http_upstream_next when u->peer.tries > 1, and call
ngx_http_upstream_finalize_request directly when u->peer.tries == 1

it would not pass NGX_PEER_FAILED to u->peer.free

so how peer->fails increase when last retry fail?

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,277494,277494#msg-277494

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Maxim Dounin
Re: ngx_http_upstream_test_next u->peer.tries > 1
November 27, 2017 03:00PM
Hello!

On Fri, Nov 24, 2017 at 03:23:30AM -0500, crasyangel wrote:

> assume all servers always fail in upstream
>
> nginx would call ngx_http_upstream_next when u->peer.tries > 1, and call
> ngx_http_upstream_finalize_request directly when u->peer.tries == 1
>
> it would not pass NGX_PEER_FAILED to u->peer.free
>
> so how peer->fails increase when last retry fail?

The result of the last attempt is returned to the client as is,
and it is not considered to be a failure regardless of other
settings. In the edge case when there is only one server,
requests are simply passed to the server.

If there is more than one server, and all servers fail, the first
request will disable all servers but the last one (assuming
default max_fails=1), and the second request will disable the last
server.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login