[英]MySQL client/server: TCP response packet with ACK flag but without PSH
I have this Linux binary application which establishes 2 persistent connections to the local MySQL server (using 127.0.0.1 as hostname). 我有这个Linux二进制应用程序,它与本地MySQL服务器建立2个持久连接(使用127.0.0.1作为主机名)。
Every 15 minutes such application has to perform 2000 single-row insert
s (please don't question database design), but what happens is that at a certain point connection B "hangs" for nearly 20 seconds right after sending the n-th insert
statement to MySQL; 这样的应用程序每15分钟必须执行2000次单行
insert
(请不要质疑数据库设计),但是发生的情况是,在发送第n个insert
后,连接B在某个点“挂起”了将近20秒对MySQL的声明; looking at a tcp dump with wireshark it turns out that in such context MySQL responds with a simple ACK packet, without any MySQL protocol specific section, but indeed without the PSH flag, so it is not recognized as a proper MySQL "response OK" message. 看着wireshark的tcp转储,事实证明,在这种情况下,MySQL以简单的ACK数据包响应,没有任何MySQL协议特定部分,但实际上没有PSH标志,因此它不被识别为正确的MySQL“响应OK”消息。
Could anyone please indicate the reason why MySQL server responds to a request query packet with a simple ACK TCP packet without the PSH flag? 谁能说明为什么MySQL服务器使用不带PSH标志的简单ACK TCP数据包响应请求查询数据包的原因?
TCP ack's are at the TCP level, not the application(mysql protocol) level. TCP ack位于TCP级别,而不是应用程序(mysql协议)级别。
The TCP stack ACK's the data you sent. TCP堆栈ACK是您发送的数据。 This means it has successfully received the data, and possbily handed the data off to the user (the mysql server in your case).
这意味着它已经成功接收了数据,并有可能将数据交给了用户(在您的情况下是mysql服务器)。
So the MySQL server is busy executing your query, and it will return an application response (the MySQL "response OK" message you're looking for) when it is done executing the query (which in your cases for some reason or another takes 20 seconds) - perhaps there is I/O contention, perhaps some other long running query holds a lock, or some other heavy work needs to be done as a result of your queries. 因此,MySQL服务器正在忙于执行查询,并且在执行完查询后将返回应用程序响应(您要查找的MySQL“响应OK”消息)(在您的情况下,由于某种原因或其他原因,它需要20秒)-可能存在I / O争用,也许其他长时间运行的查询持有锁定,或者由于查询而需要完成其他繁重的工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.