Mongo php-fpm connection pool problem

  mongodb, question

In the way of nginx+gridfs, mongos maintains a stable number of connections in its log.
Php-fpm mode connects mongos. if you do not do close operation connection and stress test, you will directly explode mongos connection.
Close, the log directly end connection, manual said good connection pool pinch ~ ~ ~
http://cn2.php.net/manual/en/mongo.co …

mongodb 2.0
pecl mongo 1.2.12

The document mentioned that connections_per_pool is unlimited by default, that is, the number of connections that can be created in each connection pool is unlimited.

You can limit it with MongoPool::setSize:http://php.net/manual/en/mongopool.se …

In addition, Mongo 2.2+ and Mongo PECL Extension 1.3+(beta) can support single-connection multiplexing, which is recommended for attention.

UPDATE:

On top of this new framework, new functionality is also implemented to provide read preference support that comes with MongoDB 2.2. The new framework no longer has the concept of a connection pool, but instead make sure there is only one connect per node/db/username.

This means that a fixed number of connections can be maintained like nginx agents, like “pipes”, but connection pools are not equal to pipes.

The ext-mongo schemes of MongoDB 2.0 and 1.2.x do not support pipes, and concurrent scripts will not reuse connections. When one script releases the connection used, another script can be used from the connection pool.