Skip to content

What is the recommended way to implement "database per tenant" for a multitenant application? #13265

Answered by vkarpov15
sadeghhosseini asked this question in Q&A

You must be logged in to vote

@sadeghhosseini depends on your use case. If you have a relatively small number of tenants (say less than 100) and you're not worried about contention between the tenants, then useDb() is fine. useDb() is easier to implement and work with, and ends up opening fewer connections to MongoDB.

But useDb() means one slow tenant can slow down the other tenants due to slow trains. That's why, for large multi-tenant setups or setups that are performance sensitive, we recommend a separate connection per tenant.

Replies: 1 comment 4 replies

You must be logged in to vote
4 replies
@sadeghhosseini

@vkarpov15

Answer selected by sadeghhosseini
@sadeghhosseini

@vkarpov15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants