Aborted_clients和 Aborted_connects狀態變數詳解 By:授客 QQ:1033553122 狀態變數定義 Aborted_clients 因客戶端消亡時未恰當的關閉連接而引起的被中斷連接數 The number of connections that were abort ...
Aborted_clients和 Aborted_connects狀態變數詳解
By:授客 QQ:1033553122
狀態變數定義
Aborted_clients
因客戶端消亡時未恰當的關閉連接而引起的被中斷連接數
The number of connections that were aborted because the client died without closing the connection properly.
Aborted_connects
連接MySQL伺服器失敗的次數。
The number of failed attempts to connect to the MySQL server。
參考鏈接:
https://dev.mysql.com/doc/refman/5.5/en/server-status-variables.html
狀態變數數值分析
查看變數值
SHOW GLOBAL STATUS LIKE 'Aborted_connects'
SHOW GLOBAL STATUS LIKE 'Aborted_clients'
Aborted_connects
如果客戶端連接mysql伺服器失敗,那麼伺服器會增加Aborted_connect變數的值,每失敗一次,變數值加1。
以下幾種情況會導致Aborted_connect變數值增加。
l 客戶端因為沒有許可權訪問資料庫導致的連接失敗
l 客戶端因為密碼錯誤導致的連接失敗
l 連接包(connection packet)沒有包含正確的信息導致的連接失敗
l 獲取連接包耗費多餘connect_timeout系統變數設置的時間導致的連接失敗,即連接超時(查看變數值SHOW GLOBAL VARIABLES LIKE 'connect_timeout';
Aborted_clients
如果客戶端成功連接,但是沒有以恰當的方式斷開連接,或者是被中斷,那麼伺服器會增加Aborted_clients狀態變數的值,每次加1,並記錄一條Aborted connection消息到錯誤日誌。
以下幾種情況會導致Aborted_clients狀態變數值增加。
l 客戶端退出之前,沒有調用mysql_close()
l 客戶端“沉睡”,超過wait_timeout 或者 interactive_timeout設置時間(單位:秒)沒有向伺服器發起任何請求。
l 客戶端程式在數據傳輸的期間突然終止。
導致aborted connections 或者aborted clients的其它原因
l max_allowed_packet
狀態變數的值設置太小,或者查詢需要消耗的記憶體比已經分配給mysqld的記憶體更大。查看 Section B.5.2.10, “Packet Too Large”。
l Linux使用的Ethernet協議,包含半雙工和全雙工。有些Linux Ethernet驅動存在這個bug。You should test for this bug by transferring a huge file using FTP between the client and server machines. If a transfer goes in burst-pause-burst-pause mode, you are experiencing a Linux duplex syndrome. Switch the duplex mode for both your network card and hub/switch to either full duplex or to half duplex and test the results to determine the best setting.
l 線程類庫存在問題導致讀取中斷。
l TCP/IP配置錯誤。
l Ethernets, hubs, switches, cables等故障,這些只能更換硬體。
參考鏈接:
https://dev.mysql.com/doc/refman/5.5/en/communication-errors.html