Implementing multitenancy
Multitenancy is the ability by which an application can act (and seem) different when observed in different ways. Think, for example, of a website that displays a different look and feel when it is accessed as http://abc.com
or http://xyz.net
. Here, we are talking about the same physical site having two different domain names bound to it, abc.com
and xyz.net
, which are the tenants.
When it comes to relational databases, there are essentially three techniques for achieving multitenancy:
- Separate database: Each tenant's data is kept in a separate database instance, with a different connection string for each; the multitenant system should pick automatically the one appropriate for the current tenant as shown in the following figure:
- Separate schema: The same database instance is used for all the tenants' data, but each tenant will have a separate schema; not all RDBMSs support this properly, for example, SQL Server doesn't, but Oracle...