I noticed that when serving images Nginx is sending images using both writev() when called from a browser such as Firefox, but uses sendfile() to send the image when wgetting the image. Any idea why its using both? I have ' sendfile on ; ' in the config. Can't find a good answer anywhere. Thanks!
Asked
Active
Viewed 675 times
1 Answers
3
I found the answer, the reason it was using writev() when using a web browser was because the browser sent headers requesting gzip. I disabled gzip on the server and now images are sent using sendfile() to wget, curl, and browsers. Mission accomplished!
#gzip on;
#gzip_comp_level 9;
#gzip_types *;

Phillip Dean
- 71
- 3
-
2You should assign a list of types you want to compress with gzip. It is still useful to compress static and dynamic HTML, CSS etc. – Tero Kilkanen Feb 10 '15 at 05:04
-
Thanks for the comment, this server is only used for image serving so that shouldn't be needed. – Phillip Dean Feb 10 '15 at 14:34
-
Also TLS will require using `writev` since (at least for now) kernel can not encrypt data for you. – SaveTheRbtz Feb 10 '15 at 19:37