[nginx] Increased the default number of output buffers.

Valentin Bartenev vbart at nginx.com
Mon Sep 21 23:55:10 UTC 2015


details:   http://hg.nginx.org/nginx/rev/0256738454dc
branches:  
changeset: 6250:0256738454dc
user:      Valentin Bartenev <vbart at nginx.com>
date:      Tue Sep 15 17:49:15 2015 +0300
description:
Increased the default number of output buffers.

Since an output buffer can only be used for either reading or sending, small
amounts of data left from the previous operation (due to some limits) must be
sent before nginx will be able to read further into the buffer.  Using only
one output buffer can result in suboptimal behavior that manifests itself in
forming and sending too small chunks of data.  This is particularly painful
with SPDY (or HTTP/2) where each such chunk needs to be prefixed with some
header.

The default flow-control window in HTTP/2 is 64k minus one bytes.  With one
32k output buffer this results is one byte left after exhausting the window.
With two 32k buffers the data will be read into the second free buffer before
sending, thus the minimum output is increased to 32k + 1 bytes which is much
better.

diffstat:

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

diffs (12 lines):

diff -r 081a073e5164 -r 0256738454dc src/http/ngx_http_copy_filter_module.c
--- a/src/http/ngx_http_copy_filter_module.c	Tue Sep 22 01:40:04 2015 +0300
+++ b/src/http/ngx_http_copy_filter_module.c	Tue Sep 15 17:49:15 2015 +0300
@@ -327,7 +327,7 @@ ngx_http_copy_filter_merge_conf(ngx_conf
     ngx_http_copy_filter_conf_t *prev = parent;
     ngx_http_copy_filter_conf_t *conf = child;
 
-    ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 1, 32768);
+    ngx_conf_merge_bufs_value(conf->bufs, prev->bufs, 2, 32768);
 
     return NULL;
 }



More information about the nginx-devel mailing list