我是开发者,目前不知道往哪方面查,请广大 v 友提供思路
问题与现状
不定期出现访问未响应情况,持续时间几分钟,期间 nginx 映射所有访问不了,并服务器也 ssh 不上,日志没出现 Too many open files 等任何报错
服务器:阿里 ecs.g7.large ,2 核 8G 内存
nginx 自己编译
nginx version: nginx/1.22.0 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: --prefix=/home/nginx --with-threads --with-file-aio --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_sub_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-pcre --with-pcre-jit --with-debug 部署服务:很多静态文件,但不是 js 、css 这些
访问量:不太清楚怎么算
目前排查情况
- 调整过 worker_connections 不起作用
- 在未响应期间,看 cpu 指标,没有明显新增,看 tcp 连接数 ESTABLISHED 和 TIME_WAIT 也不多,因不太懂 tcp 这块,不知是不是这块问题
nginx 核心配置 摘要
#user nobody; worker_processes 2; worker_cpu_affinity auto; pid logs/nginx.pid; error_log /home/nginx/logs/error.log notice; worker_rlimit_nofile 8192; events { worker_connections 4096; multi_accept on; accept_mutex on; use epoll; } http { include mime.types; default_type application/octet-stream; charset utf-8; #access_log logs/access.log main; server_tokens off; sendfile on; tcp_nopush on; tcp_nodelay on; server_names_hash_bucket_size 128; server_names_hash_max_size 512; keepalive_timeout 65; send_timeout 30s; client_header_timeout 15; client_body_timeout 15; reset_timedout_connection on; proxy_connect_timeout 5s; proxy_send_timeout 120s; proxy_read_timeout 120s; gzip on; gzip_min_length 1k; gzip_buffers 4 32k; gzip_http_version 1.1; gzip_comp_level 4; gzip_types text/css text/xml application/Javascript; gzip_vary on; gzip_disable "MSIE [1-6]."; include /home/nginx/conf/conf.d/*.conf; } 