[nginx] Changed default value of sendfile_max_chunk to 2m.

Maxim Dounin mdounin at mdounin.ru
Fri Oct 29 20:20:28 UTC 2021


details:   https://hg.nginx.org/nginx/rev/e3dbd9449b14
branches:  
changeset: 7950:e3dbd9449b14
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Fri Oct 29 20:21:57 2021 +0300
description:
Changed default value of sendfile_max_chunk to 2m.

The "sendfile_max_chunk" directive is important to prevent worker
monopolization by fast connections.  The 2m value implies maximum 200ms
delay with 100 Mbps links, 20ms delay with 1 Gbps links, and 2ms on
10 Gbps links.  It also seems to be a good value for disks.

diffstat:

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

diffs (12 lines):

diff -r 862f6130d357 -r e3dbd9449b14 src/http/ngx_http_core_module.c
--- a/src/http/ngx_http_core_module.c	Fri Oct 29 20:21:54 2021 +0300
+++ b/src/http/ngx_http_core_module.c	Fri Oct 29 20:21:57 2021 +0300
@@ -3720,7 +3720,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t 
     ngx_conf_merge_value(conf->internal, prev->internal, 0);
     ngx_conf_merge_value(conf->sendfile, prev->sendfile, 0);
     ngx_conf_merge_size_value(conf->sendfile_max_chunk,
-                              prev->sendfile_max_chunk, 0);
+                              prev->sendfile_max_chunk, 2 * 1024 * 1024);
     ngx_conf_merge_size_value(conf->subrequest_output_buffer_size,
                               prev->subrequest_output_buffer_size,
                               (size_t) ngx_pagesize);


More information about the nginx-devel mailing list