Multi tenancy or multi instance? [closed] Multi tenancy or multi instance? [closed] docker docker

Multi tenancy or multi instance? [closed]


You don't need different databases for each customer if they are going to have shared schemas anyways. Most SaaS software is multi-tenant and works in this fashion, a common database with application logic to make sure users can only access things they should be allowed to access. E.g. Facebook doesn't have billions of databases, one for each user, to make sure we can't see each other's non-public photos.

Also, the problems you're trying to solve for don't seem as though they should have any bearing on the portability of your application, or your ability to move them to the cloud. If you treat backing services, e.g. database(s), as attached resources then it doesn't really matter if you have one or many (though I still recommend you have just the one).

I'd recommend reading the 12-factor principles for SaaS development and deployment. They are a great starting point for thinking about architecting software that will work easily in a cloud-native environment. I would focus on solving the business problems of your software, and architecting it in a cloud-native way, e.g. per the 12-factor principles.

Nothing about the problems you've described suggest that Docker vs. not-Docker is even a relevant concern at this time. I.e. all your proposed approaches could be done fairly similarly with/without Docker. Docker solves problems of process isolation, packaging OS-level dependencies, reducing compute resource overhead, consistency between development and production, etc. and only seems indirectly related to what you're after.


Multi Tenancy is way to go, it is cost effective and more maintainable. Imagine you have 10 customers on 10 different versions of your application, supporting them becomes big deal. With multi tenancy you can auto scale based on the load and scale down when the load is less, with multi instance you may have to make sure at least one instance is available for each customer.

Few other reasons why I would go with Multi Tenancy

  1. One version to build and deploy
  2. Share resources like caching
  3. Testing only one version of your application
  4. Security testing will be simplified
  5. Make use of CDN effectively


Other's had these problems before. E.g. there's sth. out there called the SaaS Maturity Model. I think that most successful models started out with the functionality first, and the platform as secondary concern. So I would go with an instance per customer strategy first. Anyway how many customers will there be at the beginning? Is it more likely to fail because the customer don't like the functionality or because you are using multiple instances coming of course with a ops overhead?

=> Focus on the product/functionality first. So aim for level 1, focus on other levels later.

With Docker (at least from my perspective as one guy, that has not done a lot with it): The artifact of your development is a runnable container image. When this artifact is published to a repository it should be very easy to update all instances to use this new artifact. So with a little scripting and perhaps sth. like Kubernetes it should be doable to move even a lot of instances to a new version. So I think new developments like Docker do make multi instance setups even more feasible.

I'm doing also a SaaS product for our company. For us it is also multi instance due to business concerns:

  1. Our customers are very keen of keeping data separate from competitors. That is much easier to show with a multi instance strategy.
  2. Customers want some control of the release cycle sometimes. For example they have to communicate changes in functionality to employees or a business process is in progress that does not allow an upgrade. So they might want to wait with a new version or even skip it. Again much easier with an instance per customer.

As always with these kinds of questions, I'm giving my opinion and my experience here. It really depends on your use case - SaaS has a lot of variety.