worker_processes auto;
pid /run/nginx.pid;
worker_rlimit_nofile 100000;
error_log /var/log/nginx/error.log crit;
events {
worker_connections 4000;
multi_accept on;
use epoll;
}
http {
include /etc/nginx/mime.types;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
directio 4m;
types_hash_max_size 2048;
client_body_buffer_size 15K;
client_max_body_size 8m;
keepalive_timeout 20;
client_body_timeout 15;
client_header_timeout 15;
send_timeout 10;
open_file_cache max=5000 inactive=20s;
open_file_cache_valid 60s;
open_file_cache_min_uses 5;
open_file_cache_errors off;
gzip on;
gzip_comp_level 2;
gzip_min_length 1000;
gzip_proxied any;
gzip_types text/plain text/css application/json application/xjavascript text/xml application/xml application/xml+rss text/javascript;
access_log off;
log_not_found off;
include /etc/nginx/conf.d/*.conf;
}
该服务器有 8 个核心和 32 GB 内存。负载为 0.05,但 nginx 每秒无法处理超过 500 个请求。如何更改配置以使 nginx 每秒处理超过 500 个请求?
sysctl.conf 我已经在配置文件中做了一些更改
net.ipv6.conf.all.accept_ra = 2
net.core.rmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_wmem = 4096 16384 16777216
net.ipv4.tcp_fin_timeout = 60
net.ipv4.tcp_fin_timeout = 20
net.ipv4.tcp_tw_reuse = 0
net.ipv4.tcp_tw_reuse = 1
net.core.netdev_max_backlog = 300
net.core.netdev_max_backlog = 10000
net.core.somaxconn = 2048
net.ipv4.tcp_max_syn_backlog = 2048
net.ipv4.ip_local_port_range = 15000 65000
kernel.pid_max = 65535