• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • MsSql
  • Mysql
  • oracle
  • MariaDB
  • DB2
  • SQLite
  • PostgreSQL
  • MongoDB
  • Redis
  • Access
  • 数据库其它
  • sybase
  • HBase
您的位置:首页 > 数据库 >Mysql > MySQL和相关的timeout详细解析

MySQL和相关的timeout详细解析

作者:匿名 字体:[增加 减小] 来源:互联网 时间:2018-12-05

匿名通过本文主要向大家介绍了timeout,MySQL,解析等相关知识,希望本文的分享对您有所帮助
查询mysql库时, 在数据量比较大时,会话总断。刚开始以为是mysql的和连接有关timeout的问题,结果是网络的不稳定的原因。 本文主要介绍了MySQL和连接相关的timeout 的详细整理的相关资料,本文主要总结下和连接有关的timeout,需要的朋友可以参考下,希望能帮助到大家。

下面总结下和连接有关的timeout

slave-net-timeout

The number of seconds to wait for more data from the master before the slave considers the connection broken, aborts the read, and tries to reconnect. The first retry occurs immediately after the timeout. The interval between retries is controlled by the MASTER_CONNECT_RETRY option for the CHANGE MASTER TO statement, and the number of reconnection attempts is limited by the --master-retry-count option. The default is 3600 seconds (one hour).
当slave认为连接master的连接有问题时,就等待N秒,然后断开连接,重新连接master

net_read_timeout :

The number of seconds to wait for more data from a connection before aborting the read. When the server is reading from the client, net_read_timeout is the timeout value controlling when to abort
在终止读之前,从一个连接获得数据而等待的时间秒数;当服务正在从客户端读取数据时,net_read_timeout控制何时超时。

net_write_timeout:

The number of seconds to wait for a block to be written to a connection before aborting the write.When the server is writing to the client, net_write_timeout is the timeout value controlling when to abort。
在终止写之前,等待多少秒把block写到连接;当服务正在写数据到客户端时,net_write_timeout控制何时超时

wait_timeout

The number of seconds the server waits for activity on a noninteractive connection before closing it.
与服务器端无交互状态的连接,直到被服务器端强制关闭而等待的时间

interactive_timeout :

The number of seconds the server waits for activity on an interactive connection before closing it.
与服务器端无交互状态的连接,直到被服务器端强制关闭而等待的时间

connect_timeout

The number of seconds that the mysqld server waits for a connect packet before responding with Bad handshake. The default value is 10 seconds.

等待一个连接响应的时间

connect_timeout:在获取连接阶段(authenticate)起作用

interactive_timeout和wait_timeout:在连接空闲阶段(sleep)起作用
net_read_timeout和net_write_timeout:则是在连接繁忙阶段(query)起作用。

获取MySQL连接是多次握手的结果,除了用户名和密码的匹配校验外,还有IP->HOST->DNS->IP验证,任何一步都可能因为网络问题导致线程阻塞。为了防止线程浪费在不必要的校验等待上,超过connect_timeout的连接请求将会被拒绝。

即使没有网络问题,也不能允许客户端一直占用连接。对于保持sleep状态超过了wait_timeout(或interactive_timeout,取决于client_interactive标志)的客户端,MySQL会主动断开连接。

即使连接没有处于sleep状态,即客户端忙于计算或者存储数据,MySQL也选择了有条件的等待。在数据包的分发过程中,客户端可能来不及响应(发送、接收、或者处理数据包太慢)。为了保证连接不被浪费在无尽的等待中,MySQL也会选择有条件(net_read_timeout和net_write_timeout)地主动断开连接。

相关推荐:

JavaScript中setTimeout之单线程

实例讲解setTimeout看出js函数执行过程

js中的setTimeout()函数

以上就是MySQL和相关的timeout详细解析的详细内容,更多请关注微课江湖其它相关文章!

分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • SQL查询超时的设置方法(关于timeout的处理)
  • ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction
  • MySQL和相关的timeout详细解析
  • 探秘mysql中的timeout
  • C3P0连接池+MySQL的配置及wait_timeout问题的解决方法_MySQL
  • MySQL slave_net_timeout参数解决的一个集群问题案例

相关文章

  • 2017-05-11MySQL 百万级分页优化(Mysql千万级快速分页)
  • 2018-12-05linux如何查看mysql是否启动?
  • 2018-12-05MySQL复制的概述、安装、故障、技巧、工具(火丁分享)
  • 2017-05-11Mysql子查询IN中使用LIMIT应用示例
  • 2018-12-05在ORACLE移动数据库文件
  • 2018-12-05有关MySQL数据库中的外键约束详解
  • 2018-12-05 mysql进阶(七)limit的用法
  • 2018-12-05用MySQL分析SQL的耗时问题
  • 2017-05-11在CentOS上安装phpMyAdmin的教程
  • 2018-12-05MySQL IN 用法

文章分类

  • MsSql
  • Mysql
  • oracle
  • MariaDB
  • DB2
  • SQLite
  • PostgreSQL
  • MongoDB
  • Redis
  • Access
  • 数据库其它
  • sybase
  • HBase

最近更新的内容

    • 详细介绍linux下使用RPM安装mysql5.7.17的示例代码
    • SQL 超时解决方案 有时并不是设置问题
    • Oracle date如何比较大小分析
    • OBJECTPROPERTY与sp_rename更改对象名称的介绍
    • mysql截取的字符串函数substring_index的用法
    • 有关登陆密码的课程推荐10篇
    • mySql学习笔记:比sql server书写要简单
    • ef框架-vs2015连接数据库,实体数据模型向导在选择完后点击下一步就闪退
    • MYSQL导入导出命令详解
    • MySQL 中查找含有目标字段的表的方法

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有