Forum: NGINX Need more details about max_fails and fail_timeout

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Sun Yijiang (Guest)
on 2009-02-18 08:59
(Received via mailing list)
Hi,

I'm new to nginx, spent a morning reading nginx documentation.  I'm
still
not clear how nginx determines the status of upstream servers.  Let's
say we
have some upstream servers, all set to max_fails=3 and fail_timeout=30s.
According to the document, if one server fails 3 times within 30s time,
nginx will mark this server to be inoperative and won't direct any
request
to it.  Is that right?  Then the question is: will nginx try this server
again later to see if it recovers?  If it does, what's the algorithm?
If it
doesn't, is there any way to inform nginx after the server recovers?


Steve
Anton Y. (Guest)
on 2009-02-18 22:28
(Received via mailing list)
Sun Yijiang wrote:
> I'm new to nginx, spent a morning reading nginx documentation.  I'm
> still not clear how nginx determines the status of upstream servers.
> Let's say we have some upstream servers, all set to max_fails=3 and
> fail_timeout=30s.  According to the document, if one server fails 3
> times within 30s time, nginx will mark this server to be inoperative and
> won't direct any request to it.  Is that right?

Right

>  Then the question is:
> will nginx try this server again later to see if it recovers?

Yes, it will try to send requests after fail_timeout.

So fail_timeout used twice - errors counted for fail_timeout, and
upstream marked as dead for
fail_timeout.
Sun Yijiang (Guest)
on 2009-02-19 05:25
(Received via mailing list)
Thanks for your answer.

So to Nginx, an upstream server is either good (operative) or bad
(inoperative).  In good state, if it fails *max_fails* times within *
fail_timeout* period of time, Nginx switches its state to bad.  If not,
it
stays good.  In bad state, Nginx will try the server every
*fail_timeout*time, if succeeds, its state is switched back to good,
otherwise it stays
bad.  Nginx only dispatches requests to good servers.  Any problem with
this
summary?


Steve

2009/2/19 Anton Y. <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.