So I have a script which does the following:
for ($i = $start;$i<=$end;$i++){
shell_exec("php /home/mysql_box/script.php phrases $i {$argv[3]} > /dev/null 2>&1 &");
}
On one of my servers I would like this script to run 400 times. As part of the call it connects to a Mysql server on a different box but for some wierd reason hits about 130 connections and then errors saying "Mysql server has gone away".
I appreciate this is quite common and the MySQL manual states:
You can also encounter this error with applications that fork child processes, all of which try to use the same connection to the MySQL server. This can be avoided by using a separate connection for each child process.
However I wouldn't be using the same connection surely? My wait_timeout
is the default - but huge so why would some connections simply not be able to connect?
A couple of other points from the manual:
- The connection uses the IP not host name
- I didn't start mysql with skip-networking
- The query is a single one liner - its not big
- I am using Ubuntu
- I am connecting with PDO
I hope I've given enough info to help.