资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

MySQL和timeout的示例分析-创新互联

这篇文章主要介绍了MySQL和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)地主动断开连接。


感谢你能够认真阅读完这篇文章,希望小编分享的“MySQL和timeout的示例分析”这篇文章对大家有帮助,同时也希望大家多多支持创新互联,关注创新互联行业资讯频道,更多相关知识等着你来学习!

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


新闻标题:MySQL和timeout的示例分析-创新互联
网站地址:http://cdkjz.cn/article/dcijeo.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220