Tuning nginx worker_process to obtain 100k hits pe

2020-01-24 18:50发布

问题:

We have a server that is serving one html file.

Right now the server has 2 CPUs and 2GB of ram. From blitz.io, we are getting about 12k connections per minute and anywhere from 200 timeouts in that 60 seconds with 250 concurrent connections each second.

worker_processes  2;

events {
 worker_connections 1024;
}

If I increase the timeout, the response time starts creeping up beyond a second.

What else can I do to squeeze more juice out of this?

回答1:

Config file:

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

more info: Optimizing nginx for high traffic loads



标签: nginx