Tuning nginx worker_process to obtain 100k hits per min

我们有一个服务器提供一个 html 文件。

现在服务器有2个 CPU 和2 GB 内存。通过 blitz.io,我们每分钟可以获得大约12k 个连接,在60秒内可以获得200个超时,每秒可以获得250个并发连接。

worker_processes  2;


events {
worker_connections 1024;
}

如果我增加了超时时间,响应时间就开始慢慢超过一秒钟。

我还能做什么来挤出更多的果汁呢?

137026 次浏览

配置文件:

worker_processes  4;  # 2 * Number of CPUs


events {
worker_connections  19000;  # It's the key to high performance - have a lot of connections available
}


worker_rlimit_nofile    20000;  # Each connection needs a filehandle (or 2 if you are proxying)




# Total amount of users you can serve = worker_processes * worker_connections

更多信息: 面向高流量负载的 nginx 优化