# Premature failover to backup upstream

**URL:** <https://www.ruby-forum.com/t/premature-failover-to-backup-upstream/214366>\
**Category:** NGINX\
**Created:** [November 30, 2011, 3:06am UTC](https://www.ruby-forum.com/t/premature-failover-to-backup-upstream/214366 "2011-11-30T03:06:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [November 30, 2011, 3:06am UTC](https://www.ruby-forum.com/t/premature-failover-to-backup-upstream/214366/1 "2011-11-30T03:06:02Z")

</div>

Hello!

I am using Nginx 1.0.5 to reverse proxy to a pool of three upstreams.  
One of them is configured as a backup upstream. From time to time, very  
rarely, a request will be proxied to the backup upstream when it should  
not be. The two normal upstreams are completely healthy, and at  
extremely low load.

Why might this be happening?

I see in the documentation  
([Module ngx\_http\_upstream\_module](http://wiki.nginx.org/HttpUpstreamModule#server)) that the upstream  
module will shunt to backup if the other upstreams are “down or busy.”  
What is the definition of “busy” in this context?

Looking in the debug log, I see many many instances of “http upstream  
recv(): -1 (11: Resource temporarily unavailable)”. Is this related?

One thing I haven’t tried is to adjust the max\_fails parameter, but  
perhaps I should.

Posted at Nginx Forum:

> **[Premature failover to backup upstream](https://forum.nginx.org/read.php?2,219326,219326#msg-219326)**
>
> Hello! I am using Nginx 1.0.5 to reverse proxy to a pool of three upstreams. One of them is configured as a backup upstream. From time to time, very rarely, a request will be proxied to the backup upstream when it should not be. The two normal...

---

<div class="post-metadata">

**Author:** ![adam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.ruby-forum.com/u/adam)\
**Post date:** [November 30, 2011, 3:47am UTC](https://www.ruby-forum.com/t/premature-failover-to-backup-upstream/214366/2 "2011-11-30T03:47:28Z")

</div>

Hi,

> Looking in the debug log, I see many many instances of “http upstream  
> recv(): -1 (11: Resource temporarily unavailable)”. Is this related?

Are you using UNIX sockets? If so, try using TCP sockets, it might help.

Best regards,  
Piotr S. \< [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) \>

---

<div class="post-metadata">

**Author:** ![adam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.ruby-forum.com/u/adam)\
**Post date:** [November 30, 2011, 7:39am UTC](https://www.ruby-forum.com/t/premature-failover-to-backup-upstream/214366/3 "2011-11-30T07:39:46Z")

</div>

> Are you using UNIX sockets? If so, try using TCP sockets, it might  
> help.

Is that a configuration option at compile time?

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,219326,219339#msg-219339](http://forum.nginx.org/read.php?2,219326,219339#msg-219339)

---

<div class="post-metadata">

**Author:** ![adam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/4af34b/32.png) [@adam](https://www.ruby-forum.com/u/adam)\
**Post date:** [November 30, 2011, 8:04pm UTC](https://www.ruby-forum.com/t/premature-failover-to-backup-upstream/214366/4 "2011-11-30T20:04:24Z")

</div>

Oh, I see what you mean. We’re proxying to Tomcat upstreams on separate  
hosts, not a local fcgi or anything like that.

So, still looking for some clues.

Posted at Nginx Forum:

> **[Re: Premature failover to backup upstream](https://forum.nginx.org/read.php?2,219326,219394#msg-219394)**
>
> Hello! I am using Nginx 1.0.5 to reverse proxy to a pool of three upstreams. One of them is configured as a backup upstream. From time to time, very rarely, a request will be proxied to the backup upstream when it should not be. The two normal...
