Replies: 1 comment 2 replies
-
If you need to handle multiple accounts, then there isn't a better option than having one client per account. The only problem is, each client will have it's own independent set of connections. If you run the app in an environment where number of connections is limited (like App Service), and you are handling multiple tenants, you might reach a point where you'd exhaust available connections. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
We have a B2B multi tenant application, and use currently one DB account and several databases/containers per tenant.
Since serverless is out we've been using it for some other application, and are going to migrate our head system to serverless as well. More specifically we'll go for complete isolation by using a single DB account per tenant.
We won't have thousands of tenants so there should be no issue (we're aware of the current limits).
Our current design is a factory which returns the correct container/database based on a tenant ID and container name. Behind the bonnet we use a singleton Cosmos Cliënt, and have some concurrent dictionaries to speed up retrieval for the containers.
Now, with an account per tenant approach, do we create a cosmos cliënt per tenant, and keep these in our cache as well? Or will this cause any problems?
Beta Was this translation helpful? Give feedback.
All reactions