14. 状态页功能
6. nginx状态页功能¶
# nginx状态页需要with-http_stub_status_module模块,
# 记录nginx的基本访问状态信息
#1. 检查是否支持状态页(查看是否有with-http_stub_status_module模块!)
nginx -V
#2. 修改配置文件
vim status.conf
server {
listen 85;
location / {
stub_status on;
access_log off;
}
}
#3. 使用ab命令对nginx压力测试
ab -kc 1000 -n 1000000 http://127.0.0.1 # 开启会话保持,1000个并发,十万个请求
-n: 请求数量
-c: 并发数
-k: 启动keepalived保持连接功能
#4. 浏览器查看状态页信息
ip:85
#5. 状态页内容解释
Active connections: 2
server accepts handled requests
9006 9006 6841
Reading: 0 Writing: 1 Waiting: 1
# 使用ab压力测试时
Active connections: 736
server accepts handled requests
240850 240850 22830
Reading: 0 Writing: 1 Waiting: 735
server: 一共处理的请求数
accepts handled: 创建的握手数
requests: 一共处理了多少次请求
reading: nginx读取到客户端的headers数量
writing: nginx响应给客户端headers数量
waiting: nginx处理完请求后,等待下一次请求驻留的连接数
waiting = active - (reading + writing)
最后更新:
2022-02-20 13:32:53