今天看到了馬哥視頻其中一節對nginx狀態監控信息的介紹,對視頻ppt上的監控字段解析產生了一些疑問,ppt內容如下:
active connections – 活躍的連接數量
server accepts handled requests — 總共處理了xxx個連接 , 成功創建xxx次握手, 總共處理了xxx個請求
reading — 讀取客戶端的連接數.
writing — 響應數據到客戶端的數量
waiting — 開啟 keep-alive 的情況下,這個值等于 active – (reading+writing), 意思就是 Nginx 已經處理完正在等候下一次請求指令的駐留連接.
一開始是基于對上面介紹的連接和請求的區別不理解,于是進行了谷百,得到的解析基本與上面的介紹一致,依然沒有解決心中的疑問,最后翻閱了一下nginx的官方文檔,找到了相關的說明,并斗膽的進行了一些自我揣測,得出的答案與上面介紹有較大的出入,因此覺得有必要發篇博文出來與大家討論一下,也是出于對知識真相渴望!如有不正確的地方歡迎大家批評指正。官方原文及個人翻譯如下:
–with-http_stub_status_module配置參數開啟。ngx_http_stub_status_module模塊提供了nginx基礎狀態信息的訪問接口。這個模塊默認不編譯,需要通過
Example Configuration
location /basic_status {
stub_status;
}
上面的配置會創建一個簡單頁面來展示nginx的基礎狀態信息,顯示格式如下:
Active connections: 291
server accepts handled requests
16630948 16630948 31070465
Reading: 6 Writing: 179 Waiting: 106
-
Active connect ions
The current number of active client connections including
Waiting
connections.(原文)當前的客戶端活動連接數(包含正在等待的客戶端連接),即相當于連接狀態處于Established和SYN_ACK的tcp連接
-
accepts
The total number of accepted client connections.(原文)
已接受的客戶端連接總數,即已被worker進程接收的連接
-
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).(原文)已被處理的連接總數。其值一般與accepts相等,除非受到了某些資源的限制,如:設置了worker_connections的數量限制
-
requests
The total number of client requests.
客戶端的http請求總數
-
Reading
The current number of connections where nginx is reading the request header.
當前正在讀取的http請求數(讀取到http請求首部)
-
Writing
The current number of connections where nginx is writing the response back to the client.
當前準備響應的連接數(nginx正在寫入http響應首部)
-
Waiting
The current number of idle client connections waiting for a request.
當前處于等待的空閑客戶端請求數。等待的時間為Reading和Writing之間的間隔
-
$connections_active
與Active connections的值相同
; -
$connections_reading
與Reading的值相同
; -
$connections_writing
與Writing的值相同
; -
$connections_waiting
與Waiting的值相同
.以上內容摘自nginx官方文檔: http://nginx.org/en/docs/http/ngx_http_stub_status_module.html
ngx_http_stub_status_module支持以下內建變量
(1.3.14版本后):
原創文章,作者:gateray,如若轉載,請注明出處:http://www.www58058.com/24090