Multi tenant architecture, single database

Architecturesoftware-as-a-service

Based on this explanation of multi-tenant architectures here:

A multi-tenant architecture is one where a single software instance
and database serves multiple customers

I cannot fathom how it is preferable to have a single database instead of spawning a single/multiple databases per tenant?

I would think that it should be since resources for single-tenant architectures are hardly a fraction of its multi-tenant counterpart.

Why is it preferable to have a single database?

Best Answer

You've misunderstood the article

You've taken "multi-tenant" to mean "an application which is used by more than one tenant". I'm actually on your side here and I interpret multi-tenancy the same way, but the article uses a slightly different definition, which you seem to have missed.

In the article, and I admit I agree they should've pointed this out a bit more explicitly to avoid ambiguity, "multi-tenant" is being used to mean "more than one tenant using the same resource":

A multi-tenant architecture is one where a single software instance and database serves multiple customers (i.e. tenants).

Contrast this to the previous paragraph about single-tenancy:

Single-tenant cloud architecture is one where a single software instance and its supporting infrastructure/database serve only one customer. In a single-tenant environment, all customer data and interactions are separate from every other customer. Customer data is not housed in the same database and there’s no sharing of data in any way.

Circling back to your question:

I cannot fathom how it is preferable to have a single database (A) instead of spawning a single/multiple databases per tenant (B)?

The article doesn't claim that sharing resources is better. But when not sharing resources, the article calls it single-tenancy (B) and not multi-tenancy (A).


Single-database multitenancy

I also want to address your comment on why someone would ever use multi-tenancy (as per the article's definition of multi-tenancy).

I cannot fathom how it is preferable to have a single database instead of spawning a single/multiple databases per tenant?

Why is it preferable to have a single database?

If you allow an analogy, I cannot fathom how my parents can buy a $200 desktop and use that for all their computer activities. The desktops I build cost ten times that.

But the simple conclusion here is that not everyone needs the same specs. My parents are not power users or gamers. If they can open word/excel files and browse the internet they're happy because that's all they really need. Spending more on a better desktop would be a waste of resources for them.

Similarly, multi-tenanted applications with a small footprint and no reasonable need to think about scalability don't need a multi-database setup. Spending more time, effort and complexity on implementing it anyway is just a waste of resources.

"Better" is a very vague criterium. You intend it to mean "more robust and scalable", but you're glossing over the fact that it also costs extra time and effort. If you don't need the robustness and scalability, then using it is just a waste of resources, which means it's not "better" for your particular scenario.

Related Topic