Live data from Hacker News

Battle-ready Nginx – an optimization guide

blog.zachorr.com

11–20 of 46 posts

Re: Battle-ready Nginx – an optimization guide

#11
post #7

For anyone who is interested in nginx tuning, please follow the H5BP nginx repo: https://github.com/h5bp/server-configs-nginx , which is very well documented already and still being maintained.

Not sure about the H5BP config setting the keep-alive timeout to 20s (but would need to test to look at what resource consumption is like compared to say 5s)

The OP recommends turning off gzip in MSIE6 when it was only the very first versions of IE6 that had a problem with gzip and it was fixed in later versions.

Re: Battle-ready Nginx – an optimization guide

#12
post #7

For anyone who is interested in nginx tuning, please follow the H5BP nginx repo: https://github.com/h5bp/server-configs-nginx , which is very well documented already and still being maintained.

Link to nginx.conf: https://github.com/h5bp/server-configs-nginx/blob/master/ngi...

Thanks, this is useful—the comments especially so.

It's a shame there isn't one for reverse (HTTP) proxies: fine tuning proxy settings: proxy_buffers, buffering, etc, and other related settings when dealing with a back end application.

Re: Battle-ready Nginx – an optimization guide

#13

Good introduction to nginx. However, the guide states: "Keep in mind that the maximum number of clients is also limited by the number of socket connections available on your sytem (~64k)". This is incorrect. The system can open ~64k connections per [src ip, dst ip] pair. In the case of a webserver listening on just 1 port, it means you can open 64k connections per remote IP, which is why some people can write about h…

That's true for incoming connections, but if you're proxying back to something else then the limit does apply to the outgoing ones.

Re: Battle-ready Nginx – an optimization guide

#15
post #4
post #2

What purpose of the article if in the documentation at nginx.org/en/docs/ you can find the same? And, btw, you are giving bad advices. You are wrong here: "By default, nginx sets our keep-alive timeout to 75s (in this config, we drop it down to 10s), which means, without changing the default, we can handle ~14 connections per second. Our config will allow us to handle ~102 users per second." No, the keepalive connect…

And even more: "send_timeout 2;" Mobile clients from another continent will "thank you" for this setting when they cannot open your site. "error_log /var/log/nginx/error.log crit;" A way to be unaware when something is wrong with your server. Nginx produces not only "crit" errors, but a bunch of very useful warnings, that need attention. "limit_conn addr 10;" Chrome and Firefox usually open more than 10 connections.…

And gzip_min_length should probably be set to the MTU size

Re: Battle-ready Nginx – an optimization guide

#16
"Chances are your OS and nginx can handle more than “ulimit -a” will report, so we’ll set this high so nginx will never have an issue with “too many open files”"

If the limit is a hard limit it doesn't really matter what nginx decides to do, does it? I had to increase the limit by hand, outside of nginx.

Re: Battle-ready Nginx – an optimization guide

#17
post #7

For anyone who is interested in nginx tuning, please follow the H5BP nginx repo: https://github.com/h5bp/server-configs-nginx , which is very well documented already and still being maintained.

This post was worth it just for me to discover that this exists! Thank you!

Re: Battle-ready Nginx – an optimization guide

#18
post #7

For anyone who is interested in nginx tuning, please follow the H5BP nginx repo: https://github.com/h5bp/server-configs-nginx , which is very well documented already and still being maintained.

Not sure about the H5BP config setting the keep-alive timeout to 20s (but would need to test to look at what resource consumption is like compared to say 5s) The OP recommends turning off gzip in MSIE6 when it was only the very first versions of IE6 that had a problem with gzip and it was fixed in later versions.

>> The OP recommends turning off gzip in MSIE6 when it was only the very first versions of IE6 that had a problem with gzip and it was fixed in later versions.

And IE6 users are known far and wide for how fervently they upgrade. ;-)

Re: Battle-ready Nginx – an optimization guide

#19
Also useful for nginx: adding the pagespeed module https://github.com/pagespeed/ngx_pagespeed

"ngx_pagespeed speeds up your site and reduces page load time by automatically applying web performance best practices to pages and associated assets (CSS, JavaScript, images) without requiring you to modify your existing content or workflow."

Re: Battle-ready Nginx – an optimization guide

#20
post #7

For anyone who is interested in nginx tuning, please follow the H5BP nginx repo: https://github.com/h5bp/server-configs-nginx , which is very well documented already and still being maintained.

Not sure about the H5BP config setting the keep-alive timeout to 20s (but would need to test to look at what resource consumption is like compared to say 5s) The OP recommends turning off gzip in MSIE6 when it was only the very first versions of IE6 that had a problem with gzip and it was fixed in later versions.

No configuration is perfect in all scenarios. The good thing in using github is you can submit pull request or report issue when needed :)

[1] Why `gzip_disable` is added: https://github.com/h5bp/server-configs/pull/92

[2] Why `gzip_disable` is removed: https://github.com/h5bp/server-configs/issues/145

Post reply on HN