# Need more details about max\_fails and fail\_timeout

**URL:** <https://www.ruby-forum.com/t/need-more-details-about-max-fails-and-fail-timeout/160623>\
**Category:** NGINX\
**Created:** [February 18, 2009, 7:59am UTC](https://www.ruby-forum.com/t/need-more-details-about-max-fails-and-fail-timeout/160623 "2009-02-18T07:59:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sun\_Yijiang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e8c25b/32.png) [@Sun\_Yijiang](https://www.ruby-forum.com/u/Sun_Yijiang)\
**Post date:** [February 18, 2009, 7:59am UTC](https://www.ruby-forum.com/t/need-more-details-about-max-fails-and-fail-timeout/160623/1 "2009-02-18T07:59:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Sun\_Yijiang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e8c25b/32.png) [@Sun\_Yijiang](https://www.ruby-forum.com/u/Sun_Yijiang)\
**Post date:** [February 19, 2009, 4:25am UTC](https://www.ruby-forum.com/t/need-more-details-about-max-fails-and-fail-timeout/160623/2 "2009-02-19T04:25:29Z")

</div>

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](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![Sun\_Yijiang](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e8c25b/32.png) [@Sun\_Yijiang](https://www.ruby-forum.com/u/Sun_Yijiang)\
**Post date:** [February 18, 2009, 9:28pm UTC](https://www.ruby-forum.com/t/need-more-details-about-max-fails-and-fail-timeout/160623/3 "2009-02-18T21:28:08Z")

</div>

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.
