Welcome! Log In Create A New Profile


Gzip vs. sendfile

Joó Ádám
August 24, 2015 05:52PM

From https://www.nginx.com/blog/tuning-nginx/:

> Note, however, that because the data never touches user space it’s not subject to the filters in the regular NGINX processing chain. As a result, filters that change content, for example the gzip filter, have no effect.

Which never occurred to me, but sounds reasonable. What is more
surprising is that I found virtually no discussion on this, and I
wasn’t able to reproduce it.

Using the following configuration:

types {
text/plain txt;

gzip on;
gzip_comp_level 5;
gzip_types text/plain;

sendfile on;

the files are still served gzipped. The author of

> There is a tradeoff between using compression (saving your bandwidth) and using the sendfile feature (saving your CPU cycles). If the connector supports the sendfile feature, e.g. the NIO connector, using sendfile will take precedence over compression. The symptoms will be that static files greater that 48 Kb will be sent uncompressed.

However, increasing the file size to more than 200 KB still has no
effect on the encoding.

Is it actually the other way around and filters disable sendfile?


nginx mailing list
Subject Author Posted

Gzip vs. sendfile

Joó Ádám August 24, 2015 05:52PM

Re: Gzip vs. sendfile

Maxim Dounin August 25, 2015 08:40AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 127
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready