Apache / PHP processes freeze when interacting with MySQL

We observe some strange behavior, and we are not sure if this is a problem with apache, php, mysql or the OS, so let's move on to the big brains of stackoverflow!

We have Apache and mod_php talking to mysql5 server. Sometimes a process chooses a hang while trying to read from a file descriptor.

Dismissal for one of them (all hanging processes showed the same results):

[root@prweb133v ~]# strace -p 8450
Process 8450 attached - interrupt to quit
read(57,  <unfinished ...>

So what was he trying to read?

[root@prweb133v ~]# lsof -p 8450
...
...
httpd   8450 apache   57u  IPv4    5546599             TCP
prweb133v.local:36615->hadat.local:mysql (ESTABLISHED)

What is our mysql server! Well, maybe he was trying to read the query results, I thought. Checking the list of processes on the mysql server, the connection was established, but in the SLEEP state.

Hmmm.

So, I checked netstat to find out who is trying to send / receive what.

On the web server:

[root@prweb133v ~]# netstat -t -n -a | grep 36615
tcp        0      5 172.23.179.6:36615          172.23.179.67:3306         
ESTABLISHED 

mysql , 0 .

, 5 mysql?

!

Mike

+5
2

mysql- (myisam, innodb,...)? mysql mysqli php?

"log" "log_slow_queries" mysql (, ramdisk) "SHOW GLOBAL STATUS"; mysql ( , "* _waits" ).

- " " mysql? ?

php.ini (60) mysql.connect_timeout? "mysql.trace_mode" "on" - .

-, , /URL- "ab", .

: apache prefork ( "Startservers 1", "MaxSpareServers 0", - ) -, . .

+1

- e-mailled , OP , :

- , , , - mysql. , - apache, - , , ( ) .

, .

+1

All Articles