Welcome! Log In Create A New Profile

Advanced

Re: nginx timeout aborting subsequent proxying from upstream block

Posted by Mauri, Richard 
This is question about configuring nginx so that when you have multiple servers in an upstream block and the first one selected to handle a request "times out" (at default 60s) that we can skip the forwarding to subseqnt servers in the upstream block.

We see the case where the upstream_response_time in nginx log shows like 60s,60s.

We have a client that aborts the request/connection at 20sec and other clients that ultimately fail because the server responded with failure with the 60s,60s upstream_response time.

We want to institutionalize the aggregate 20s round trip client request time at the server side if possible.

In other words we don't want to configure the proxy read and write timeout settings to 20 as this might result in total of 40s as observed by the client.

We don't want to set the seetings to like 10s as that may not give the server enough time to complete processing.

Rather we want the proxy read write timeouts to be 20s and the entire request to fail immediately without going to the next server in the upstream block.

How is nginx configured so if the first upstream server times-out; then subsequent servers are not consulted and the server effectively timeout at 20?

I hope this makes sense
Thanks


_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Hello!

On Tue, Dec 20, 2016 at 06:31:46PM +0000, Mauri, Richard wrote:

>
> This is question about configuring nginx so that when you have
> multiple servers in an upstream block and the first one selected
> to handle a request "times out" (at default 60s) that we can
> skip the forwarding to subseqnt servers in the upstream block.
>
> We see the case where the upstream_response_time in nginx log
> shows like 60s,60s.
>
> We have a client that aborts the request/connection at 20sec and
> other clients that ultimately fail because the server responded
> with failure with the 60s,60s upstream_response time.
>
> We want to institutionalize the aggregate 20s round trip client
> request time at the server side if possible.
>
> In other words we don't want to configure the proxy read and
> write timeout settings to 20 as this might result in total of
> 40s as observed by the client.
>
> We don't want to set the seetings to like 10s as that may not
> give the server enough time to complete processing.
>
> Rather we want the proxy read write timeouts to be 20s and the
> entire request to fail immediately without going to the next
> server in the upstream block.
>
> How is nginx configured so if the first upstream server
> times-out; then subsequent servers are not consulted and the
> server effectively timeout at 20?

Try this:

proxy_next_upstream_timeout 20s;

See http://nginx.org/r/proxy_next_upstream_timeout for additional
details.

--
Maxim Dounin
http://nginx.org/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login