proxy_next_upstream, only "connect" timeout?
Gábor Farkas
gabor.farkas at gmail.com
Wed Jun 13 12:09:32 UTC 2012
hi,
is there any way to tell nginx to fallback to the next upstream in
case of timeout,
but only if the timeout occured during connection (for example because
the upstream's backlog is full),
and not when the upstream is already processing the request? basically
the case specified by the proxy_connect_timeout.
it seems if i do:
"proxy_next_upstream timeout", then this can happen:
1. nginx sends the request to upstream1
2. upstream1 begins processing the request, stores data in the db, etc
3. while upstream1 creates the response, the timeout happens, and
nginx sends the request to upstream2
4. upstream2 begins processing the request, stores data in the db, etc
at this point the request was processed twice, data were written in
the database twice etc. i would like to avoid it.
but, on the other hand, if i say "proxy_next_upstream off", then this
can happen:
1. nginx sends the request to upstream1
2. upstream1's socket-backlog is full, so nginx returns a http504 to
the user, even if there is upstream2, that theoretically could have
served the request.
any ideas how to handle this situation?
thanks,
gabor
More information about the nginx
mailing list