Linux – Connecting to thesql over TCP hangs for 3 seconds

linuxMySQLslow-connectiontcp

I have a problem with a newly installed MySQL box:

When trying to access the database with multiple clients and a lots of retries, sporadically, connecting takes longer than 3 seconds. I only get this behaviour when I try to connect over tcp (no matter if the client is local or remote). If this state is reached, every connection, regardless of the port, takes 3 seconds.

I tried to reproduce this behaviour on another server, but neither the old database server nor the new slave show this behaviour (which to me doesn't make any sense, since master and slave are running on the same OS, the same patch level, the same database version, the same config…)

Searching the internet, I found a link to an email that describes exactly what I experience: http://www.mail-archive.com/linux-net@vger.kernel.org/msg02040.html, but I couldn't find any solutions.

Does anyone have any experience that could explain this?

Best Regards,

Cassy

Edit: Before anyone asks: it's not a DNS issue, we set skip-name-resolve as a default in every new MySQL installation.

Best Answer

on the server box run tcpdump on lo and on network interface. what does it show ?

can it be some wiredness in authentication [ eg ldap / nis lookup on server that does not respond ] ?

ps - maybe you have not seen this.

edit apparently in this case last one was the solution. apparently kernels < ~2.6.24.5 have some bug when ipv6 is disabled that results in 3 sec delay for this specific case.