本文介绍了调整 nginx worker_process 以获得每分钟 10 万次点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们有一台服务于一个 html 文件的服务器.
We have a server that is serving one html file.
现在服务器有 2 个 CPU 和 2GB 的内存.从 blitz.io 中,我们每分钟获得大约 12k 个连接,在这 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 万次点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!