Our multi-tenant app has about 4000 databases per tenant and we are having a problem with performance because of too many connections. Creating MongoDB connections on each database is a heavy operation.

We tried the following approaches but still could not reduce the number of connections.

  1. Sharding only applying for the datasets
  2. Increasing the pool size already applied

How to reduce the number of MongoDB connections? Is there any way to split databases into 1000,1000?


You can bind connections per DB at mongodb level but can limit at application end.

You can also increase max connection on mongodb with some tweaking on OS level. Still best approach is to put limit and application end with persistent properties.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.