What is multi-tenancy?
Multi-tenant architecture · the opposite of single-tenant
Multi-tenancy means one running system serves many customers at once, with every record marked to show who it belongs to and rules preventing anyone from seeing a record marked for someone else. The alternative, single-tenancy, gives each customer their own separate copy of the software to maintain.
In practice: one system, not twenty copies. Adding your next client becomes a row in a table rather than another deployment to keep patched, and every client is on the same version because there is only one.
Twenty clients should not mean twenty copies.
The obvious way to serve several clients from one piece of software is to give each of them their own copy. It works fine for the first three. By the tenth, a bug fix means ten deployments, and the copies have quietly drifted apart.
Multi-tenancy is the other approach: one running system, with every record marked with who it belongs to, and rules that make sure nobody ever sees a record marked for someone else.
One copy per clientsingle tenant
Four deployments, four sets of logs, four chances to forget one. A bug fix is four releases. Two of these are already on old versions and nobody noticed.
One system, marked rowsmulti tenant
Every row carries its owner. A bug fix is one release and all four have it. Adding a fifth client is a row, not a deployment. Figures are invented.
The catch is that the separation now has to be enforced by the system rather than by physical separation, which is why it has to be structural.
How the separation is enforced.
If four clients' data sits in one database, the only thing keeping them apart is the rule that filters it. There are two ways to implement that rule and the difference is the whole safety story.
| Filtered in the application | Enforced in the database | |
|---|---|---|
| Where the rule lives | In each query a developer writes | Once, as a policy on the table |
| What one forgotten filter costs | One client sees another's data | Nothing. The database returns no rows |
| New developer joins | They have to know the convention | They cannot bypass it by accident |
| Reviewing it | Read every query, forever | Read one policy |
| Known as | Application-level filtering | Row-level security |
This is the single question worth asking any vendor selling you a multi-tenant product: where is the separation enforced?
It is the difference between ten clients and a hundred.
- Adding a client stops being work. A row instead of a deployment is the difference between growth costing engineering time and growth costing nothing.
- Everyone is on the same version. No client is quietly running last year's software because their upgrade got skipped.
- One place to fix things. A bug found by one client is fixed for all of them at once, which is also how you find out about it faster.
- The risk moves, it does not disappear. You are trading deployment sprawl for a separation rule that must never fail. That trade is worth it, and only if the rule is structural.
Every portal we run.
One system, many clients, enforced at the database
Buzzlead's client portal, BrokerStaffer's client portals and the reply inbox behind them are all one application each, serving every client from one database, with every business table carrying the workspace it belongs to.
The separation is a database policy rather than a filter someone remembers to write, so a mistake in the application code cannot return another client's rows. That is what makes handing out a portal link an ordinary thing to do rather than a nervous one.
Words that turn up next to this one.
Still unclear?
What is multi-tenancy?
Multi-tenancy means one running system serves many customers at once, with every record marked to show who it belongs to and rules that prevent anyone seeing a record marked for someone else. The alternative, single-tenancy, gives each customer their own separate copy of the software.
What is the difference between multi-tenant and single-tenant?
Single-tenant means one copy of the application per customer, so ten customers means ten deployments to maintain and ten chances for versions to drift apart. Multi-tenant means one deployment serving all ten, where adding a customer is a row in a table rather than a release.
Is multi-tenancy safe if all the data is in one place?
It is safe when the separation is enforced by the database rather than by the application. With row-level security the database itself refuses to return another customer's rows, so a forgotten filter in application code cannot leak data. If separation depends on every query being written correctly, it will fail eventually.
When should I choose single-tenant instead?
When a customer contractually requires their data to be physically separate, when they need to run a different version, or when a regulator requires isolation you can point at. Those are real cases. Outside them, single-tenancy usually means paying maintenance costs for a guarantee you could get another way.
Does multi-tenancy make the software cheaper to build?
Not to build. It is more work up front, because the separation rules have to be designed rather than assumed. It is dramatically cheaper to run and to grow, because the tenth and hundredth customer cost almost nothing to add.
Wondering what this would look like on your stack?
Thirty minutes. We will tell you whether it is worth building and what it would take. No deck.
OpsLabs builds custom operational systems for growing companies. This page is part of a plain-English glossary of the terms that appear in our proposals and on this site.