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
Connection poolSize limit? #6206
Comments
There's a Can you clarify what you mean by "100s or 1000s of connections"? |
@vkarpov15 sure thing. When users log into the app, they will need to be able to switch between different databases (one at a time) and perform CRUD operations on whichever database they're connected to at the time. My problem is with how this is going to scale. If I have potentially 1000 (or more) users logged in, performing operations on different databases, will mongoose be able to handle that with pools (ie. 1 pool connection per person logged in) or should I maybe create a new mongoose instance per new database connection? There could also be overlap (ie. 5 users logged in performing operations onto the same DB). |
After taking a second glance at the docs http://mongoosejs.com/docs/connections.html it sounds like I can't leverage the connection pool to facilitate writing/reading to different databases. It sounds like the connection pool only makes connecting to any one database more efficient which is nice. I think what I'll have to do is create multiple mongoose connections using |
For your application I think multiple connection pools is the way to go. Ultimately it comes down to the fact that mongodb can only make progress on one operation per socket connection at a time, so if you just have 5 sockets in your pool and you have 5 very slow operations running, any fast operations that come in will be blocked. If you have different databases and different users with very different workloads, one user might slow down other users. Also, FYI, we don't really have this documented well yet, but we have the option to cache connections to |
@vkarpov15 sounds good, thanks for the heads up about the caching as well - I think I can make use of that! |
Forgive me if there's already been an answer to this somewhere, but I haven't seen anything definitive in the docs.
Is there a limit to the size of the connection pool?
I have a situation where there could be 100s or 1000s of connections open at once - should the connection pool be used for this or would that be an abuse of the feature?
The text was updated successfully, but these errors were encountered: