Welcome! Log In Create A New Profile

Advanced

proxy_next_upstream, only "connect" timeout?

Gábor Farkas
June 13, 2012 08:10AM
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

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

proxy_next_upstream, only "connect" timeout?

Gábor Farkas June 13, 2012 08:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 123
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready