]> git.kaiwu.me - nginx.git/commitdiff
Changed default value of sendfile_max_chunk to 2m.
authorMaxim Dounin <mdounin@mdounin.ru>
Fri, 29 Oct 2021 17:21:57 +0000 (20:21 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Fri, 29 Oct 2021 17:21:57 +0000 (20:21 +0300)
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.

src/http/ngx_http_core_module.c

index bad43ea5c9793988b989188210bea642eb1afba2..fe1da4576c29d08b84a68518b59e9d44a2693709 100644 (file)
@@ -3720,7 +3720,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
     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);