nginx查看并发连接数

通过查看Nginx的并发连接,我们可以更清除的知道网站的负载情况。Nginx并发查看有两种方法(之所以这么说,是因为笔者只知道两种),一种是通过 web界面,一种是通过命令,web查看要比命令查看显示的结果精确一些。

通过web界面查看时Nginx需要开启status模块,也就是安装Nginx时加上 –with-http_stub_status_module 然后配置Nginx.conf,在server点里面加入如下内容

location /status {

stub_status on;

access_log /usr/local/nginx/logs/status.log;

auth_basic “NginxStatus”; }

配置完后重新启动Nginx后我们可以通过浏览器访问http://localhost/status 查看

201005231274583316394

解析:
Active connections //当前 Nginx 正处理的活动连接数。
server accepts handled requests //总共处理了8 个连接 , 成功创建 8 次握手,总共处理了500个请求。
Reading //nginx 读取到客户端的 Header 信息数。
Writing //nginx 返回给客户端的 Header 信息数。
Waiting //开启 keep-alive 的情况下,这个值等于 active – (reading + writing),意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接

评论

此博客中的热门博文

FreeBSD安装Pure-FTPd及user manager for PureFTPd

debian lighttpd php ssl

解决nginx出现File not found的问题