`

nginx - stub_status 连接数查看

    博客分类:
  • webs
阅读更多
【基本介绍】
这里介绍nginx的stub_status模块,可以查看当前web的连接数,请求数等。


【模块查看】
nginx的stub_status模块支持访问状态的信息。所有要查看该模块是否已经安装。
nginx -V | grep ngx_http_stub_status_module



【基本配置】
location /nginx_status {
     stub_status on;
     access_log off;
     allow xxx
     deny all;
}


【内容解释】
Active connections: 291
server accepts handled requests
16630948 16630948 31070465
Reading: 6 Writing: 179 Waiting: 106

The following status information is provided:
Active connections(当前客户连接数)
    The current number of active client connections including Waiting connections.
accepts(总共接收的客户连接数)
    The total number of accepted client connections.
handled(总共处理的连接数)
    The total number of handled connections. Generally, the parameter value is the same as accepts unless some resource limits have been reached (for example, the worker_connections limit).
requests(总共请求数)
    The total number of client requests.
Reading(当前读取请求头的连接数)
    The current number of connections where nginx is reading the request header.
Writing(当前反馈给客户端的连接数)
    The current number of connections where nginx is writing the response back to the client.
Waiting(当前连接等待请求数)
    The current number of idle client connections waiting for a request.


【其他方式】
还有其他通过命令还来查看连接数的方式,只能是预估并不准确。
[root@sparkVM script]# netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' 
TIME_WAIT 1
ESTABLISHED 890

[root@sparkVM script]# ps -ef | grep nginx | wc -l 
14



【参考引用】
http://nginx.org/en/docs/http/ngx_http_stub_status_module.html
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics