Gzip compression and Transfer-Encoding

Igor Sysoev is at rambler-co.ru
Mon Oct 22 14:11:48 MSD 2007

On Mon, Oct 22, 2007 at 05:53:22PM +1000, Dave Cheney wrote:

> 	We use the following settings for gzip compression
>    gzip  on;
>    gzip_min_length  1100;
>    gzip_comp_level  5;
>    gzip_buffers     4 16k;
>    gzip_types       text/html text/plain text/xml text/css  
> application/x-javascript application/atom+xml;
> 	Which leads to good compression but regardless of the size of the  
> document always requires chunked encoding to send the resulting data.  
> For larger documents this doesn't matter, but for smaller documents I  
> would like to provide a Content-Length header and avoid chunked  
> encoding.

What problem with chunked encoding ?

> 	Is their a buffer setting that specifies the size of the initial  
> buffer to be compressed, the idea being that if the whole response  
> body fits in that one buffer, it can be compressed in one go, and the  
> resulting content length discovered.

The problem is that gzip is filter: the header sent to client before
compression even starts. However, it is possible to postpone header
processing to know the compressed size.

Igor Sysoev

More information about the nginx mailing list