大家好,我想请问一下这个问题,不知道是否有人遇到过.在一个每秒查询在1k以上的mysql, 偶尔会发生连接等待的情况, 如下日志: [3000.4179477692] - [3000.1637935638] - [0.030994415283203] - [0.2131462097168] - [0.010013580322266] - [121.168.1.10 via TCP/IP] - select name from users where id=2903139日志时间分别是:总时间-连接时间-prepare-execute-fetchAll(PDO::FETCH_ASSOC)-$conn->getAttribute(PDO::ATTR_CONNECTION_STATUS)使用的是pdo_mysql, 机器是2008 x86_64 x86_64 x86_64 GNU/Linux, 2CPUx4cores Intel(R) Xeon(R) CPU E5405 @ 2.00GHz, 16G内存.sysctl.conf:net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296net.ipv4.ip_conntrack_max = 255444
net.ipv4.tcp_max_tw_buckets = 80000
net.ipv4.tcp_max_syn_backlog = 8192
#net.ipv4.tcp_max_syn_backlog = 65536
net.core.netdev_max_backlog = 32768
net.core.somaxconn = 32768net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2net.ipv4.tcp_tw_recycle = 1
#net.ipv4.tcp_tw_len = 1
net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 30
net.ipv4.ip_local_port_range = 1024 65535
mysql: thread_cache_size = 64
thread_concurrency = 16
max_connections = 1024肯定没有达到连接上线,机器看起来也很正常.
多谢.
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296net.ipv4.ip_conntrack_max = 255444
net.ipv4.tcp_max_tw_buckets = 80000
net.ipv4.tcp_max_syn_backlog = 8192
#net.ipv4.tcp_max_syn_backlog = 65536
net.core.netdev_max_backlog = 32768
net.core.somaxconn = 32768net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2net.ipv4.tcp_tw_recycle = 1
#net.ipv4.tcp_tw_len = 1
net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_mem = 94500000 915000000 927000000
net.ipv4.tcp_max_orphans = 3276800net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 30
net.ipv4.ip_local_port_range = 1024 65535
mysql: thread_cache_size = 64
thread_concurrency = 16
max_connections = 1024肯定没有达到连接上线,机器看起来也很正常.
多谢.
http://www.google.com.hk/url?sa=t&rct=j&q=mysql%2B3%2Bseconds%2BTCP%2BSYN%2Bretry&source=web&cd=47&ved=0CEMQFjAGOCg&url=http%3A%2F%2Ffixunix.com%2Fkernel%2F362233-%255B2-6-24-3%255D%255Bnet%255D-bug-tcp-3rd-handshake-abnormal-timeouts.html&ei=cFWmToX-DMefiQeH5sD6DQ&usg=AFQjCNE2KXwpGfErucKTj1Rm1nBKOLcgEw
看上去,是个linux kernels的bug,等稍后尝试一下高版本.和网络无关.