How to implement Multi-tenancy

A multitenant solution is one used by multiple customers, or tenants. Tenants are distinct from users. Multiple users from a single organization, company, or group form a single tenant.

There is a solution architecture for provisioning multi-tenant system by using multiple database.

What you need to understand :

  1. Logical and physical tenants

Logical tenant is what user see but physical tenant is something at real physical sharing between tenants.

For example : Logical tenant A and B is share same physical resource (app, database, services..).

2. level of multi tenant isolation

We have different level of isolation sharing between multi tenants :

Each solution for isolation level has pros and cons. For example of Database isolation:

One database per tenantDatabase can be created in dedicated server or distributed to many servers. Hard for provisioning and manage. But highest scalability.
One table per tenantEach tenant has own table with prefix_name. Share same single db.
Less database instance to manage.
One table share multi tenantsEach table has column tennant_id to classify each tenant data. Harder to scale for each tenant separately.
%d bloggers like this: