当前位置: 移动技术网 > IT编程>数据库>Mysql > MySQL Aborted_clients和 Aborted_connects状态变量详解

MySQL Aborted_clients和 Aborted_connects状态变量详解

2019年09月30日  | 移动技术网IT编程  | 我要评论

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   状态变量的值设置太小,或者查询需要消耗的内存比已经分配给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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网