nginx的活跃连接持续增长

nginx的活跃连接持续增长,nginx,netstat,keep-alive,Nginx,Netstat,Keep Alive,我有几个nginxweb服务器作为反向代理 我发现一些服务器(并非所有服务器)中的活动连接(包括读写和等待,从http_stub_status模块中可以看到)在不断增长 从3000到5000,10000。。。。10公里。。。50k,即使在深夜也不要减少 同时,我从netstat得到了一个更可靠的数字 netstat -nap | grep 80 | grep EST | wc -l 2743 keepalive_超时为10秒 辅助进程都是同时启动的 5265 nginx: master pr

我有几个nginxweb服务器作为反向代理

我发现一些服务器(并非所有服务器)中的活动连接(包括读写和等待,从http_stub_status模块中可以看到)在不断增长 从3000到5000,10000。。。。10公里。。。50k,即使在深夜也不要减少

同时,我从netstat得到了一个更可靠的数字

netstat -nap | grep 80 | grep EST  | wc -l
2743
keepalive_超时为10秒

辅助进程都是同时启动的

5265 nginx: master process         6-19:18:55 May19

24498  \_ nginx: worker process         59:34 19:16

24499  \_ nginx: worker process         59:34 19:16

24500  \_ nginx: worker process         59:34 19:16

24501  \_ nginx: worker process         59:34 19:16

24502  \_ nginx: cache manager pr       59:34 19:16
我在以下位置发现了类似的问题:

但对我来说似乎不一样

error.log中没有相关错误

系统是

cat /etc/issue
CentOS release 5.3 (Final)
Kernel \r on an \m

uname -a
Linux 2.6.18-128.el5xen #1 SMP Wed Jan 21 11:12:42 EST 2009 x86_64 x86_64 x86_64 GNU/Linux
nginx版本:

nginx -V
nginx version: Nginx/1.0.14
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-44)
TLS SNI support disabled
configure arguments: --prefix=/home/web/nginx/ --user=nobody --group=nobody 
--with-    http_ssl_module --with-http_sub_module --with-http_dav_module 
--with-http_flv_module --    with-http_gzip_static_module 
--with-http_stub_status_module --http-proxy-temp-path=/home/web/nginx/data/proxy 
--http-fastcgi-temp-path=/home/web/nginx/data/fastcgi 
--http-client-body-temp-path=/home/web/nginx/data/client --with-pcre=../pcre-7.9 
--add-module=../ngx_http_upstream_keepalive-d7643c291ef0 
--add-module=../hmux/ --add-module=../nginx-sticky-module-1.0/ 
--with-google_perftools_module --add-module=../nginx_upstream_check_module-660183a
模块包括:

1: for cookie sticky
nginx-sticky-module.googlecode.com
2: hmux module for resin
code.google.com/p/nginx-hmux-module/
3: upstream check module
github.com/yaoweibin/nginx_upstream_check_module
4: upstream keepalive
mdounin.ru/hg/ngx_http_upstream_keepalive/
所有补丁都应用于nginx src代码

nginx.conf:
这可能是需要一些TCP参数调整的问题。查看本主题以了解一些深入信息:

特别是@jeffatrackaid的回复:

下面是对sysctl.conf的建议:

net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_rmem = 4096 87380 8388608
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1

这可能是需要一些TCP参数调整的问题。查看本主题以了解一些深入信息:

特别是@jeffatrackaid的回复:

下面是对sysctl.conf的建议:

net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_rmem = 4096 87380 8388608
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1