PATCH Upstream: new "keepalive_max_connection_duration" directive

Maxim Dounin mdounin at
Wed Apr 7 23:07:31 UTC 2021


On Wed, Apr 07, 2021 at 08:51:38PM +0300, Jussi Maki wrote:

> # HG changeset patch
> # User Jussi Maki <jusmaki at>
> # Date 1617816597 -10800
> #      Wed Apr 07 20:29:57 2021 +0300
> # Node ID 3699288ff20a3e51ee4b7689898ce0241f64f0f5
> # Parent  e2e9e0fae74734b28974c64daacc492d751b4781
> Upstream: new "keepalive_max_connection_duration" directive
> Added a new keepalive_max_connection duration which provides
> the time in milliseconds for the upstream block on how long
> the connection should be kept connected. The current keepalive
> directives either define the idle time or the number of requests
> but there is no elapsed time-based parameter.
> The elapsed time-based connection parameter is useful in a case
> when there are multiple backends and the connection should be
> evenly load balanced to them and the response times for upstream
> requests vary.

Thanks for the patch.  I've just committed a patch series which 
adds the "keepalive_time" directive[1] both for keepalive connections 
with clients and with upstream servers, as a part of a mitigation 
for browser issues identified in ticket #2155[2].  As far as I 
can see, it is basically identical to what you are trying to 
introduce for uptream servers, and should work for your use case 
as well.


Maxim Dounin

More information about the nginx-devel mailing list