0

I am building a selenium test suite which pulls a list of tests to run and then forks those tests to multiple parallel processes. Each process needs its own connection to the database because of two reasons: one, when the child process ends the connection is closed and two, when you have several processes sharing a connection and all running queries at the same time, sometimes mysql can generate some strange errors. The problem that I am running into is that since each process is going to need its own connection, I am worried about running out of connections. Is there a way to have PDO wait for an avaialbe connection if max connections is hit?

Edited by R0bb0b

3
Contributors
3
Replies
17
Views
2 Years
Discussion Span
Last Post by veedeoo
0

I suppose I could just do a loop with a nested try catch with a sleep. Unless there are more elegant ideas I guess I'll go with that.

Edited by R0bb0b

1

another thoughts..

you can also count the PROCESSLIST to find out if you are on the max connection allowed , then let the next connection to sleep, check on wake up and then sleep if there is not available slot, else let the processes to continue. 150 is a lot of connections already, but I have seen people have it set to more than 4000.

The safest and most elegant ways of doing this is probably increasing the max_connections value to some desired number, but reasonably fair to the database server to handle.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.