单服务器的并发能力需要依赖多方法的优化。
nginx 服务的并发能力如何
一、 配置
user root;
worker_processes auto;
error_log /opt/nginx/error.log;
pid /opt/nginx/pid;
worker_rlimit_nofile 204800;
events {
accept_mutex on;
multi_accept on;
use epoll;
worker_connections 102400;
}
http {
include mime.types;
include /etc/nginx/conf.d/*.conf;
default_type application/octet-stream;
access_log /opt/nginx/access.log ;
proxy_set_header Connection "";
proxy_http_version 1.1;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 0;
#keepalive_requests 1000;
types_hash_max_size 2048;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_types text/plain application/x-javascript text/css application/xml;
gzip_vary on;
server {
listen 9999;
server_name 127.0.0.1;
access_log off;
location / {
return 200 'This is text!';
#proxy_pass http://test_tornado/;
}
}
}
二、测试
操作系统的配置优化经过多次测试,多结果影响不大, 暂且不谈!
1. webbench -c 1 -t 10 http://127.0.0.1:9999/
Speed=1229292 pages/min, 3462505 bytes/sec.
Requests: 204882 susceed, 0 failed.
2.webbench -c 10 -t 10 http://127.0.0.1:9999/
Speed=2789364 pages/min, 7856709 bytes/sec.
Requests: 464894 susceed, 0 failed.
客户端继续增加并不会再提高并发, 可见nginx本身能负载的并发大概50000qps左右。
猜测:系统cpu和内存负载并不高, 是IO瓶颈吗, 是进程频繁调度导致性能下降吗?nginx本身处理能力低?
三、附件
附系统性能负载截图:
网友评论