标签:
1 MongoDB 内置连接池,不需要使用额外的连接池驱动
Note: The Mongo object instance actually represents a pool of connections to the database; you will only need one object of class Mongo even with multiple threads. See the concurrency doc page for more information.
The Mongo class is designed to be thread safe and shared among threads. Typically you create only 1 instance for a given DB cluster and use it across your app. If for some reason you decide to create many mongo intances, note that:
2 连接池配置如下:
内置连接池有多个重要参数,分别是:
其设置方式如下:
MongoOptions opt = mongo.getMongoOptions(); opt.connectionsPerHost = 10 ; //poolsize opt.threadsAllowedToBlockForConnectionMultiplier = 10 ; |
标签:
原文地址:http://www.cnblogs.com/dogharry/p/4453754.html