Upstream: Count peer->fails if peers->single is 1

Maxim Dounin mdounin at
Wed Mar 8 22:57:04 UTC 2023


On Wed, Mar 08, 2023 at 09:11:01AM +0900, u5h wrote:

> Hello.
> The upstream peer status is always up when the upstream peer is single.
> FYI:
> The conventional upstream round robin hasn't count peer->fails anywhere
> when it is peers->single is 1.
> Thus we’d like to only count it, but not to judge that the peer is down.

As per nginx usage of upstreams with a single peer, such peers are 
never considered unavailable, and to do this failures are never 
counted (or, which is equivalent, immediately forgotten).  

If you are trying to show status of a peer as seen by nginx, then 
"up" is perfectly correct for such peers.  If you are instead 
trying to show some abstract state based on request failures, then 
looking into the peer's data feels wrong to me: rather, you should 
look into request results (and/or upstream states), and collect 
relevant stats yourself.

Maxim Dounin

More information about the nginx-devel mailing list