0

I'm using VestCP which installed for me Apache2.2, PHP 5.5.25, MySQL Percona and Nginx.

I have an app built in ZF1 which works fine on all my development computers but on this server the application has a few pages that load in ~1 minute. I took the queries and run them in PhpMyAdmin, the query is finished in 0.7s so the queries are ok. There is no more php processing after retrieving this data from DB except converting it in JSON.

Running mysqladmin processlist show that the query is in Sleep command for ~1 minute. Other pages works just fine.

I tried straceing the http process but nothing popped out.

I need help debugging this because I've been struggling for 3 days straight and i'm out of ideas.

Thanks!

Edit: Strace on mysql:

[root@gameiki mysql]# ps ax|grep mysql
 6310 pts/0    S      0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql/ --pid-file=/var/run/mysqld/mysqld.pid
 6807 pts/0    Sl     0:08 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql/ --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/log/mysqld.log --open-files-limit=65535 --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
10612 pts/0    S+     0:00 grep mysql
[root@gameiki mysql]# strace -p 6807
Process 6807 attached - interrupt to quit
restart_syscall(<... resuming interrupted call ...>) = 1
fcntl(10, F_GETFL)                      = 0x2 (flags O_RDWR)
fcntl(10, F_SETFL, O_RDWR|O_NONBLOCK)   = 0
accept(10, {sa_family=AF_INET, sin_port=htons(33878), sin_addr=inet_addr("127.0.0.1")}, [16]) = 31
fcntl(10, F_SETFL, O_RDWR)              = 0
getsockname(31, {sa_family=AF_INET, sin_port=htons(3306), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
gettimeofday({1432578937, 481232}, NULL) = 0
fcntl(31, F_SETFL, O_RDONLY)            = 0
fcntl(31, F_GETFL)                      = 0x2 (flags O_RDWR)
setsockopt(31, SOL_SOCKET, SO_RCVTIMEO, "\36\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 0
setsockopt(31, SOL_SOCKET, SO_SNDTIMEO, "<\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16) = 0
setsockopt(31, SOL_IP, IP_TOS, [8], 4)  = 0
setsockopt(31, SOL_TCP, TCP_NODELAY, [1], 4) = 0
futex(0x103f2c4, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x103f2c0, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1}) = 1
poll([{fd=10, events=POLLIN}, {fd=12, events=POLLIN}], 2, -1

EDIT2: I believe I found the culprit, this strace is on httpd server right before it hangs:

10779      0.000048 socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 20
10779      0.000047 connect(20, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, "2607:f8b0:4002:c06::5b", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
10779      0.000114 getsockname(20, {sa_family=AF_INET6, sin6_port=htons(36601), inet_pton(AF_INET6, "2604:4300:a:6e:0:45ff:fec5:bfdb", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 0
10779      0.000056 close(20)           = 0
10779      0.000063 gettimeofday({1432580645, 65863}, NULL) = 0
10779      0.000060 socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 20
10779      0.000060 fcntl(20, F_GETFL)  = 0x2 (flags O_RDWR)
10779      0.000046 fcntl(20, F_SETFL, O_RDWR|O_NONBLOCK) = 0
10779      0.000045 connect(20, {sa_family=AF_INET6, sin6_port=htons(80), inet_pton(AF_INET6, "2607:f8b0:4002:c06::5b", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 EINPROGRESS (Operation now in progress)
10779      0.000148 poll([{fd=20, events=POLLIN|POLLOUT|POLLERR|POLLHUP}], 1, 60000) = 0 (Timeout)

I feel I'm close but can't make much of that strace, could it be ipv6 fault ? If so, how can I force php/httpd not use it ?

1 Answer 1

0

The issue was caused by the IPV6, I disabled ipv6 by adding

#disable ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

to /etc/sysctl.conf and there were no more delays.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .