Mongodb Connection pool

94 views
Skip to first unread message

Nrupen Desai

unread,
Jun 11, 2015, 11:26:28 PM6/11/15
to mongod...@googlegroups.com

I am using mongodb replicaiton with PHP on the production. I want to manage connection pool in mongodb. I have tried many options like MongoPool::size() and other options which were there in the PHP manaul. There are not working for me. I am stressing my system and i need to increase connection pool to handle the load.

Is there any way that i can manage number of connections in mongodb or by passing parameters in connection string. Currently i have connection timeout, socket timeout, wtimeout parameters in the mongodb connection string.


I have also found that connections are managed by PHP-Mongo drivers.


Also refered this for connection pooling http://docs.mongodb.org/manual/reference/connection-string/


Any idea, How to implement this in PHP?

Jeremy Mikola

unread,
Jun 12, 2015, 2:03:06 PM6/12/15
to mongod...@googlegroups.com
The current PHP driver has no notion of a connection pool. There was previously some form of it in version 1.2.x, but the MongoPool class you're referring to has been deprecated and non-functional since 1.3.0. The class only exists for backwards compatibility. We chose to emit deprecation notices and make the classes non-functional, as removing them entirely could have harshly broken existing applications.

The standard behavior in the PHP driver since 1.3.0 has been to use persistent connections. The driver hashes connections by host, port, auth credentials, replica set name, and PID and persists them for re-use in subsequent requests by the same worker process. MongoClient::getConnections() can be used to get information about all persisted connections.

Reply all
Reply to author
Forward
0 new messages