Centos TCP/IP connection very slow

centos6lampslow-connection

I have a VSP (centos6.1 64bit) with 4gb ram.

It always runs well, but in recent few days, the server become slowly. open a small css file need 22 seconds(2kb). tested in home/office/phone with (IE,chrome,safari,firefox). see in firebug networking

DNS Lookup   ​4 ms
Connecting   ​21.18 s
Sending  1 ms
Waiting  ​115 ms
Receiving    ​9 ms

The connection cost 21.18 seconds

I have checked all the log file, there have no error. top commond, still have free memory.

top - 00:23:15 up 8 days,  3:57,  1 user,  load average: 3.60, 3.42, 3.83
Tasks: 221 total,   4 running, 217 sleeping,   0 stopped,   0 zombie
Cpu(s): 19.3%us,  3.2%sy,  0.0%ni, 76.1%id,  1.4%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   4194304k total,  3247724k used,   946580k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
32357 mysql     15   0 3710m 835m 6268 S 34.5 20.4  39:14.40 mysqld
 9780 apache    15   0  442m  59m  12m S 33.2  1.4   0:05.69 httpd
 9842 apache    15   0  403m  26m  10m S 16.9  0.7   0:01.23 httpd
 9847 apache    15   0  412m  45m  22m R 15.3  1.1   0:01.00 httpd
 9834 apache    15   0  426m  46m  11m R 13.0  1.1   0:02.22 httpd
 9891 apache    15   0  407m  43m  19m S  8.0  1.1   0:00.33 httpd
 9845 apache    15   0  414m  51m  24m S  6.0  1.3   0:01.53 httpd
 9827 apache    15   0  402m  28m  11m S  3.3  0.7   0:02.69 httpd
 9768 apache    16   0  414m  51m  24m S  3.0  1.3   0:06.51 httpd
 9889 root      15   0  211m  12m 8160 S  2.7  0.3   0:00.32 php
 9702 apache    15   0  415m  55m  26m S  1.7  1.4   0:10.67 httpd
 9844 apache    15   0  413m  47m  21m S  1.7  1.2   0:01.21 httpd
 9697 apache    15   0  414m  51m  24m S  1.3  1.3   0:11.05 httpd
 9778 apache    15   0  414m  53m  25m S  1.3  1.3   0:05.38 httpd
 9772 apache    15   0  414m  51m  23m R  0.7  1.3   0:05.04 httpd
 9823 apache    15   0  415m  50m  23m S  0.7  1.2   0:03.97 httpd
 9837 apache    15   0  402m  27m  11m S  0.3  0.7   0:01.04 httpd

Then, how to check where is the problem and fixed it? I haven't change and config files in these days. Thanks.

Best Answer

I have heard that in case of broken IPv6 connectivity, Windows will wait exactly 21 seconds before falling back to IPv4. And the symptom of that failure should match exactly what you see, namely a long delay on establishing a connection.

What can be done about this problem?

  • Monitor connectivity. You can have some probes that periodically check connectivity to the server over IPv4 and some that check connectivity over IPv6. If either breaks, you need to get notified about which protocol broke. More information means less guessing.
  • Debug the connectivity issue. Use traceroute from client to server and vice-versa to find out where the problem is.
  • Use a browser, which is more resilient to connectivity failures.
Related Topic