Wait wait wait.
This is an expected behaviour.
Upon initial connection to mongod of each PHP process we will connect
to all the members of the replicaset.
If the server is completely turned off then we have to wait until the
packages sent figureout that there is no server up with that ip
address and go back home to us and let us know (or timeout).
If the server is turned on the packages will wind up on the correct
server - if mongod isn't running, the server will let us know in
timely fashion and the connection establishment fails fast.
We will monitor the status of the replicaset and every once in a while
check if the server has come online again.
Now, everytime you instanciate a new MongoClient() object, we will run
through the seedlist and and check for changes of the topology and
therefore attempt to connect to the server which is down, again.
To configure this connection timeout you can pass in "connectTimeoutMS" option:
$mongoclient = new MongoClient("host1,host2", array("replicaSet" =>
"name", "connectTimeoutMS" => 500)); // Wait half a second
(This option will be in 1.3.4, along with the "socketTimeoutMS" which
controls data transmission timeouts).
Now. Writing up this reply I realise how stupid this behaviour is.
Since the connections are persistent, there is no reason for us to
attempt to reconnect to the failed server on the next request as we
already know it is down.
We should be waiting until we hit the ping/ismaster interval to
attempt to reconnect to that server.
I'll create a ticket for this. Thanks for the headsup!
-Hannes
> --