|
Posted by Locu on 04/12/06 19:26
I notice with PHP if a connection cannot be established to a mysql
server with mysql_connect() PHP will timeout and never try the backup
server. In this example:
$db = mysql_connect('db1.local.net', 'username', 'password');
if (!$db) {
$db = mysql_connect('db2.local.net', 'username', 'password');
}
This works great and connects to the 2nd database if the 1st one
rejects the connection completely; however, if the 1st db is under high
load and doesn't respond for 10+ seconds it never jumps to the 2nd one.
Curious if there's a better way to accomplish this. If the 1st db
doesn't respond in 1 second max I'd like to hop to the 2nd one.
Does the newer mysqli_connect handle this better, anyone know?
[Back to original message]
|