我们无法在 nginx 中处理超过 3k 的并发请求(Connecton 超时)。我们还将 ulimit 更改为 20000。以下是我的 nginx.conf 和 sysctl.conf 文件:
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 5000;
use epoll;
# multi_accept on;
} # took it in next line
worker_rlimit_nofile 100000;
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 600;
send_timeout 600;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
reset_timedout_connection on;
types_hash_max_size 2048;
client_header_buffer_size 5k;
open_file_cache max=10000 inactive=30s;
open_file_cache_valid 60s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log off;
error_log /var/log/nginx/error.log;
gzip on; …Run Code Online (Sandbox Code Playgroud)