The truth about gzip_buffers?
mdounin at mdounin.ru
Mon May 20 11:26:28 UTC 2013
On Sat, May 18, 2013 at 09:02:14AM -0400, spdyg wrote:
> Reading the docs on nginx.org and searching around, it seems there's no
> consensus on how we should configure gzip_buffers.
Just keep the default?
> Some guides say that the total buffer needs to be greater than any file you
> want to gzip, or it will either not gzip the file or truncate it (I'm sure
> this is not true though!). Other guides suggest arbitrary values.
> I guess I have a couple of questions to clear up this confusion:
> 1. What happens if the response is greater than the total gzip buffer. Will
> it simply keep the upstream connection open longer while it fills, gzips and
> transmits the buffers multiple times?
Rest of the response will be kept till some buffers are sent to
Keeping upstream connection open is generally irrelevant - it
depends mostly on proxy_buffers/proxy_max_temp_file_size - but
might happen in some configurations.
> 2. If your page size is 4k, does that mean for best efficiency shoudl you
> keep the size of the buffers to 4k, but just increase the total number of
> buffers? What is the consideration here?
Much like with other buffers in nginx, small buffers means better
memory utilization, but larger buffers might result in smaller CPU
usage as there are some amount of work done per-buffer.
> 3. Would having larger buffer sizes potentially allow greater compression
> because each buffer is compressed individually?
More information about the nginx