Welcome! Log In Create A New Profile

Advanced

[nginx] Changed keepalive_requests default to 1000 (ticket #2155).

Maxim Dounin
April 07, 2021 06:36PM
details: https://hg.nginx.org/nginx/rev/82e174e47663
branches:
changeset: 7822:82e174e47663
user: Maxim Dounin <mdounin@mdounin.ru>
date: Thu Apr 08 00:16:30 2021 +0300
description:
Changed keepalive_requests default to 1000 (ticket #2155).

It turns out no browsers implement HTTP/2 GOAWAY handling properly, and
large enough number of resources on a page results in failures to load
some resources. In particular, Chrome seems to experience errors if
loading of all resources requires more than 1 connection (while it
is usually able to retry requests at least once, even with 2 connections
there are occasional failures for some reason), Safari if loading requires
more than 3 connections, and Firefox if loading requires more than 10
connections (can be configured with network.http.request.max-attempts,
defaults to 10).

It does not seem to be possible to resolve this on nginx side, even strict
limiting of maximum concurrency does not help, and loading issues seems to
be triggered by merely queueing of a request for a particular connection.
The only available mitigation seems to use higher keepalive_requests value.

The new default is 1000 and matches previously used default for
http2_max_requests. It is expected to be enough for 99.98% of the pages
(https://httparchive.org/reports/state-of-the-web?start=latest#reqTotal)
even in Chrome.

diffstat:

src/http/modules/ngx_http_upstream_keepalive_module.c | 2 +-
src/http/ngx_http_core_module.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diffs (24 lines):

diff -r 6d4f7d5e279f -r 82e174e47663 src/http/modules/ngx_http_upstream_keepalive_module.c
--- a/src/http/modules/ngx_http_upstream_keepalive_module.c Thu Apr 08 00:16:17 2021 +0300
+++ b/src/http/modules/ngx_http_upstream_keepalive_module.c Thu Apr 08 00:16:30 2021 +0300
@@ -159,7 +159,7 @@ ngx_http_upstream_init_keepalive(ngx_con

ngx_conf_init_msec_value(kcf->time, 3600000);
ngx_conf_init_msec_value(kcf->timeout, 60000);
- ngx_conf_init_uint_value(kcf->requests, 100);
+ ngx_conf_init_uint_value(kcf->requests, 1000);

if (kcf->original_init_upstream(cf, us) != NGX_OK) {
return NGX_ERROR;
diff -r 6d4f7d5e279f -r 82e174e47663 src/http/ngx_http_core_module.c
--- a/src/http/ngx_http_core_module.c Thu Apr 08 00:16:17 2021 +0300
+++ b/src/http/ngx_http_core_module.c Thu Apr 08 00:16:30 2021 +0300
@@ -3758,7 +3758,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t
ngx_conf_merge_sec_value(conf->keepalive_header,
prev->keepalive_header, 0);
ngx_conf_merge_uint_value(conf->keepalive_requests,
- prev->keepalive_requests, 100);
+ prev->keepalive_requests, 1000);
ngx_conf_merge_uint_value(conf->lingering_close,
prev->lingering_close, NGX_HTTP_LINGERING_ON);
ngx_conf_merge_msec_value(conf->lingering_time,
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Changed keepalive_requests default to 1000 (ticket #2155).

Maxim Dounin 80 April 07, 2021 06:36PM

Re: [nginx] Changed keepalive_requests default to 1000 (ticket #2155).

Piotr Sikora 6 April 08, 2021 10:58PM

Re: [nginx] Changed keepalive_requests default to 1000 (ticket #2155).

Maxim Dounin 8 April 09, 2021 09:52AM



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

Online Users

Guests: 48
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready