简体   繁体   中英

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).

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; 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.

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?

TCP ack's are at the TCP level, not the application(mysql protocol) level.

The TCP stack ACK's the data you sent. This means it has successfully received the data, and possbily handed the data off to the user (the mysql server in your case).

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM