Mongo Connection Pooling(Changing the size of connection pool)

前端 未结 3 402
渐次进展
渐次进展 2021-01-22 22:56

How to change the mongo connection pool size?

I have seen it is 100 by default. Is there a way to change this value?

I dont want to do it via spring, is there a

3条回答
  •  滥情空心
    2021-01-22 23:36

    As another option(and more convenient for me), connection pool size can be changed via MongoDb URI. Sample:

     MONGODB_URI (mongo):   mongodb://user:password@localhost:27017/users_db?ssl=true&maxPoolSize=10&readPreference=primaryPreferred&replicaSet=Dev-shard-0&authSource=admin
    

    Where maxPoolSize=10 param is max amount of connections. There are also some additional parameters for configuring connection pool in such way, for details - refer to the documentation - https://docs.mongodb.com/manual/reference/connection-string/

提交回复
热议问题