Score:0

effect of fail_timeout and max_fails in upstream in nginx

ng flag

I have a public facing nginx server acting as reverse proxy for an on-premises upstream server. I have two ISP providers so I want nginx to failover to the backup ISP whenever primary ISP fails.

Criteria:

  • I want to failover to backup line at the very first connection problem.
  • Whenever the failover happens, I want to stick to the backup line(if backup line is functional) for 30s before retying primary line.

Below is the upstream config I made by referring various snippets available online:

upstream remote_server {
    server 1.2.3.4:443 fail_timeout=10 max_fails=1; # primary_line_ip
    server 5.6.7.8:443 fail_timeout=30 backup; # backup_line_ip
}

However, I need help with below questions:

  1. What does fail_timeout=10 indicate? - Does it mean that nginx will wait for 10s for connection to timeout before failover?
  2. What are the implications of setting fail_timeout=0? - Does it mean that nginx will always try all the request on primary line and use backup only if primary fails?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.