Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDB, does MaxPoolSize limit applies to all the client instances?

Tags:

c#

mongodb

I increased MaxPoolSize value to 3000. does this mean that there are 3000 concurrent connections allowed using this instance, or it counts any other connections through other object instances too?

var connectionString = "mongodb://username:password@ip:27017/MyDB?maxPoolSize=3000"
var client = new MongoClient(connectionString);
return client.GetDatabase(databaseName);
like image 791
Blendester Avatar asked Dec 25 '17 16:12

Blendester


1 Answers

Well, it's not exactly as you said. This article provides a brief explaination of how connection pooling works is and it basically states that:

Most MongoDB drivers support a parameter that sets the max number of connections (pool size) available to your application. The connection pool size can be thought of as the max number of concurrent requests that your driver can service. The default pool size varies from driver to driver, e.g. for Node it is 5, whereas for Python it is 100. If you anticipate your application receiving many concurrent or long-running requests, we recommend increasing your pool size- adjust accordingly!

The total incoming connection limit on the server is determined by the lesser of the limits imposed by the operating system or maxIncomingConnections (or maxConns in MongoDB 2.4 and earlier).

Actually, the difference between the two settings is as follows:

  • Connection Pooling = limit of connections per client
  • Connections Limit = total allowed client connections
like image 120
Tommaso Belluzzo Avatar answered Oct 13 '22 01:10

Tommaso Belluzzo