Skip to content

Instantly share code, notes, and snippets.

@gerhard
Created June 14, 2012 11:59
Show Gist options
  • Save gerhard/2929885 to your computer and use it in GitHub Desktop.
Save gerhard/2929885 to your computer and use it in GitHub Desktop.
nginx upstream fail_timeout not respected
$ time curl -I "$uri" &> /dev/null
# when routed to the host that is up
curl -I "$uri" &> /dev/null 0.00s user 0.00s system 2% cpu 0.299 total
# when routed to the host that is down. Should this be ~3s as per fail_timeout & max_fails?
curl -I "$uri" &> /dev/null 0.00s user 0.00s system 0% cpu 21.304 total
upstream master_apache {
server master-local max_fails=3 fail_timeout=1s; # up and available
server slave-local max_fails=3 fail_timeout=1s; # temporarily down
keepalive 4;
}
@gerhard
Copy link
Author

gerhard commented Jun 14, 2012

The servers configured in the upstream are saying: "consider me down if I fail 3 times within 1s". Upping the fail_timeout to 30s and setting a 2s proxy_connect_timeout did the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment