Hello,
From the way I understand if there are ‘n’ servers listed as part of
an upstream block & upstream returns failure (as defined by
proxy_next_upstream), then nginx retries the same request on another
upstream server and this repeats till every upstream is tried once
(excluding those that are considered to be down).
If an upstream block is defined with exactly one active server, I see
that the request gets retried on the same upstream in case of a failure
upto ‘max_retries’ number of times. Logically, I’d expect it to try just
once and then give up if upstream fails to provide a suitable response.
Could someone tell me what is the expected behaviour?
Hello!
On Sat, Nov 20, 2010 at 09:48:15PM +0530, Arvind Jayaprakash wrote:
Hello,
From the way I understand if there are ‘n’ servers listed as part of
an upstream block & upstream returns failure (as defined by
proxy_next_upstream), then nginx retries the same request on another
upstream server and this repeats till every upstream is tried once
(excluding those that are considered to be down).
Yes.
If an upstream block is defined with exactly one active server, I see
that the request gets retried on the same upstream in case of a failure
upto ‘max_retries’ number of times. Logically, I’d expect it to try just
once and then give up if upstream fails to provide a suitable response.
There is no such thing as ‘max_retries’. As in previous case, all
(i.e. the only one in this case) upstreams are tried once and then
appropriate error returned.
Maxim D.
On Nov 21, Maxim D. wrote:
Yes.
If an upstream block is defined with exactly one active server, I see
that the request gets retried on the same upstream in case of a failure
upto ‘max_retries’ number of times. Logically, I’d expect it to try just
once and then give up if upstream fails to provide a suitable response.
There is no such thing as ‘max_retries’. As in previous case, all
(i.e. the only one in this case) upstreams are tried once and then
appropriate error returned.
My bad, I meant max_fails.
I’ve managed to reproduce a problem where the same upstream gets
retried.
When an upstream block contains one active and one backup server, the
same request gets retried. Commenting out the backup (line 22 in the
conf) however seems to exhibit the defined behaviour of try exactly
once. The access log contains the status for the 2 cases.
I’ve been able to reproduce this on many versions (0.8.[33,34,53])
Hello!
On Sun, Nov 21, 2010 at 06:49:01PM +0530, Arvind Jayaprakash wrote:
[…]
When an upstream block contains one active and one backup server, the
same request gets retried. Commenting out the backup (line 22 in the
conf) however seems to exhibit the defined behaviour of try exactly
once. The access log contains the status for the 2 cases.
“backup” is known to have this problem, yes.
Maxim D.