Maxim Dounin
January 10, 2022 08:14PM
Hello!

On Fri, Dec 31, 2021 at 02:24:13PM +0000, 幼麟 封 wrote:

> You are right, we can’t completely avoid this kind of problem,
> but we can reduce some. Maybe "keepalive_graceful_close" is not
> exact, it should be "wait_keepalive_on_exit". I mean, with this
> patch, I want to optimize the connection closure problem caused
> by the exit of the work process, is an optimization for a
> specific scene. By setting a shorter expiration time for the
> keepalived connection on the client side than the
> "keepalive_timeout" on the nginx side, we can really reduce the
> number of client retries.

Sure enough, by waiting longer before closing the keepalive
connection we can reduce retries. But this delays worker shutdown
and therefore comes at cost, and this cost might be bigger than
saved client retries. Further, this won't completely eliminate
retries anyway, even if clients are configured to use shorter
timeouts than nginx: there are cases when nginx closes keepalive
connections before keepalive_timeout expires, notably when there
are no free worker connections.

I've committed the patch to disable keepalive as long as we know
it cannot be used when sending response headers. This should
significantly reduce retries in practical cases, and comes at
(almost) no cost. Thanks for prodding this.

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

[PATCH] HTTP: keepalive_graceful_close support

Youlin Feng 511 December 17, 2021 01:00AM

Re: [PATCH] HTTP: keepalive_graceful_close support

Maxim Dounin 176 December 27, 2021 09:10AM

Re: [PATCH] HTTP: keepalive_graceful_close support

封 幼麟 160 December 28, 2021 10:38AM

Re: [PATCH] HTTP: keepalive_graceful_close support

Maxim Dounin 146 December 28, 2021 11:22AM

RE: [PATCH] HTTP: keepalive_graceful_close support

幼麟 封 128 December 31, 2021 09:26AM

Re: [PATCH] HTTP: keepalive_graceful_close support

Maxim Dounin 204 January 10, 2022 08:14PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

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