Aborted_clients Aborted_connects状态变量详解

 

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

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

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄