最近在尝试提高NGNIX的QPS,但尝试了很多方法都没有很好的效果,目前在两台高配并配有万兆网卡的服务器上简单的http get只能够做到40K~50KQPS,每次get的网页只有612B,下面是我的详细配置,并附nginx.conf,能否给些建议?非常感谢!
Server/Client CPU: Dual E5-2690v3
OS: CentOS6.2
kernel: 2.6.32.220
nginx版本:1.9.10
ab版本: Version 2.3 <$Revision: 655654 $>
SELinux disabled
iptables stopped
ulimit -n 1000000
ixgbe驱动已更新至最新,并确认万兆口中断能够向各cpu均匀分发
实验过程中尝试了各种worker_processes值以及各种配置都没有什么本质改善,有一次只启动8个nginx进程并用taskset将nginx进程绑定至8个core,每个cpu依旧只有30%的占用率,说明nginx根本没有积极相应客户端请求。
当测试https时更是只有500~600QPS。
这里感到比较迷茫不知nginx哪儿出了问题,还望不吝赐教!!
#user nobody;
#worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000;
#worker_processes 24;
#worker_cpu_affinity auto;
worker_processes 45;
worker_cpu_affinity auto;
#thread_pool default threads=48 max_queue=65536;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
worker_rlimit_nofile 20480;
events {
worker_connections 1638400;
multi_accept on;
use epoll;
accept_mutex off;
}
#ssl_engine cavium;
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
#keepalive_timeout 0;
keepalive_timeout 65;
reset_timedout_connection on;
types_hash_max_size 2048;
server_tokens off;
server_names_hash_bucket_size 256;
client_max_body_size 32k;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
server {
listen 443 ssl;
server_name localhost;
ssl on;
ssl_certificate /usr/local/nginx/conf/server.crt;
ssl_certificate_key /usr/local/nginx/conf/server.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers ALL;
#ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
root html;
index index.html index.htm;
}
}
}