mongodb - mongo php-fpm 连接池问题
黄舟
黄舟 2017-04-21 10:56:23
0
1
1040

用nginx+gridfs的方式,mongos的日志中保持稳定的连接数。
php-fpm模式连接mongo,如果不做close操作连接,压力测试,直接爆掉mongos的连接。
close的话,日志里直接end connection,手册里说好的连接池捏~~~
http://cn2.php.net/manual/en/mongo.co...

mongodb 2.0
pecl mongo 1.2.12

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
左手右手慢动作

The document mentions that connections_per_pool defaults to unlimited, which means there is no limit to the number of connections that can be created in each connection pool.

You can use MongoPool::setSize to limit: http://php.net/manual/en/mongopool.se...

In addition, Mongo 2.2+ with Mongo PECL extension 1.3+ (beta) can support single connection reuse, it is recommended to pay 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 an nginx proxy, like a "pipeline", but a connection pool is not equal to a pipe.

The ext-mongo solution of MongoDB 2.0 and 1.2.x does not support pipes. Concurrent scripts will not reuse connections. When a script releases the connection used, another script can use it from the connection pool. .

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template