本文介绍了调整nginx worker_process以获取每分钟10万次匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一台提供一个html文件的服务器.

We have a server that is serving one html file.

现在服务器具有2个CPU和2GB的内存.从blitz.io,我们每分钟获得约12,000个连接,并且在60秒钟内有200次超时,并且每秒250个并发连接.

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?

推荐答案

配置文件:

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

这篇关于调整nginx worker_process以获取每分钟10万次匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 17:33