Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default connection pool changed to 100 with bump to mongodb driver 4.x ? #10809

Closed
philsch opened this issue Sep 29, 2021 · 2 comments
Closed
Assignees
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation
Milestone

Comments

@philsch
Copy link

philsch commented Sep 29, 2021

Hello,

The default behavior of the connection pool seems to have changed with mongodb driver 4.x and is therefore affecting the mongoose 6.x release. I know this seems to be related to the mongodb driver directly, but maybe someone can help to confirm our experience. If you can confirm that the default maximum pool size is now out of sudden 100, this might need to be noted in the migration guide (as this might have a critical impact on MongoDB servers when application servers scale).

https://github.com/Automattic/mongoose/blob/5.13/package.json ("mongodb": "3.6.8")

From the MongoDB Driver documentation (https://mongodb.github.io/node-mongodb-native/3.6/api/global.html#MongoClientOptions)

poolSize | number | <optional> | (default: 5) The maximum size of the individual server pool
...
maxPoolSize | number | <optional> | (default: 10) Only applies to the unified topology The maximum number of connections that may be associated with a pool at a given time. This includes in use and available connections.

minPoolSize | number | <optional> | (default: 0) Only applies to the unified topology The minimum number of connections that MUST exist at any moment in a single connection pool.

https://github.com/Automattic/mongoose/blob/master/package.json ("mongodb": "4.1.1")

From the MongoDB Driver documentation (https://docs.mongodb.com/drivers/node/current/fundamentals/connection/)

maxPoolSize | integer | 10 | Specifies the maximum number of connections that a connection pool may have at a given time.

However in their code I can not find a reference to a default value of 10, for me it looks like the default is 100 -> https://github.com/mongodb/node-mongodb-native/search?l=TypeScript&q=maxPoolSize

This would match the behavior we experienced by upgrading to Mongoose 6.x.

@sean-daley
Copy link

Looks like the mongo team confirmed your question in https://jira.mongodb.org/browse/NODE-3641 ?

@philsch
Copy link
Author

philsch commented Sep 30, 2021

Yes and they are evaluating now to upgrade their migration guide documentation accordingly. It might make sense to add this information to the mongoose guide https://mongoosejs.com/docs/migrating_to_6.html too?

@vkarpov15 vkarpov15 added the docs This issue is due to a mistake or omission in the mongoosejs.com documentation label Oct 1, 2021
@vkarpov15 vkarpov15 modified the milestones: 6.0.10, 6.0.9 Oct 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs This issue is due to a mistake or omission in the mongoosejs.com documentation
Projects
None yet
Development

No branches or pull requests

3 participants