Welcome! Log In Create A New Profile

Advanced

Re: Re: How to control keepalive connections for upstream before the version of 1.15.3

Maxim Dounin
February 25, 2019 09:44AM
Hello!

On Mon, Feb 25, 2019 at 09:46:56PM +0800, yf chu wrote:

> But if a connection to upstream is dead or there are some other
> network problems in this connection, how could Nginx handle it,
> will the HTTP requests on this connection be affected? For
> example, is it possible that the HTTP requests on this
> connection is hanging until timeout?

If a connection is silently dead, nginx will have to wait till a
relevant timeout expires. If a network error occurs, nginx will
be able to detect this and will act accordingly. If a network
error or timeout occurs when re-using a keepalive connection,
nginx will retry a request as per proxy_next_upstream (and will
allow an additional retry attempt to make sure even requests to a
single upstream server a retryed).

Note this doesn't really depend on using keepalive connections, as
well as keepalive_requests and keepalive_timeout directives.
Though some network problems may become more obvious when using
keepalive connections. In particular, a statefull firewall
between nginx and a backend can be a problem if states are dropped
after some inactivity timeout, and using keepalive_timeout may
help to mitigate such problems (though using proxy_socket_keepalive
or removing the firewall might be a better way to go).

The main goal of the keepalive_timeout directive is to avoid the
race between closing of a connection by the upstream server and
using this connection for another request, most importantly in
case of non-idempotent requests which cannot be retried.

The main goal of the keepalive_requests directive is to make sure
connections will be closed periodically and connection-specific
memory allocations will be freed.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

How to control keepalive connections for upstream before the version of 1.15.3

yf chu February 25, 2019 03:04AM

Re: How to control keepalive connections for upstream before the version of 1.15.3

Maxim Dounin February 25, 2019 07:24AM

Re:Re: How to control keepalive connections for upstream before the version of 1.15.3

yf chu February 25, 2019 08:48AM

Re: Re: How to control keepalive connections for upstream before the version of 1.15.3

Maxim Dounin February 25, 2019 09:44AM

Re: Re: How to control keepalive connections for upstream before the version of 1.15.3

wu560130911 November 19, 2019 09:48PM

Re: Re: How to control keepalive connections for upstream before the version of 1.15.3

Francis Daly November 20, 2019 03:40PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 299
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