Dev tools
Multi Tenant Architecture for SaaS: A Plain Guide
Multi tenant architecture explained: single tenant vs multi tenant, silo, pool and bridge models, database designs, isolation, noisy neighbours, examples.
Multi tenant architecture is a way of building software where one running application and its infrastructure serve many customers (tenants) at once, while keeping each customer's data and settings separate. It's how most SaaS products work: every customer logs into the same application, but sees only their own data. Sharing infrastructure lowers costs and makes updates simple, at the price of careful isolation, protection against one tenant slowing down others, and more complex compliance. The main design choice is how much to share: everything (pooled), nothing (siloed), or a mix.
This guide explains single tenant vs multi tenant, the types of multi tenant architecture (silo, pool and bridge), database designs from shared tables to database-per-tenant, how to isolate tenants securely, the noisy neighbour problem, a multi tenant architecture example with real trade-offs, the pros and cons, and how to choose.
What Is Multi Tenant Architecture?
A tenant is a customer, usually an organisation with its own users, data and configuration. In a multi tenant system:
- one codebase and one deployment serve all tenants;
- compute, databases and storage are shared to some degree;
- every request is tagged with a tenant identity, and the system enforces that a tenant can only reach its own data;
- tenants can customise settings, branding or features without changing the shared code.
The analogy often used is an apartment building: tenants share the structure, plumbing and electricity, but each has a locked unit. A single tenant system is more like a street of detached houses: everyone gets their own building, which costs more but offers more control and separation.
Salesforce popularised the model in business software, and it's now the default for SaaS products from project management tools to accounting software. Our what is SaaS guide covers the business side of software as a service.
Single Tenant vs Multi Tenant
| Single tenant | Multi tenant | |
|---|---|---|
| Infrastructure | Dedicated per customer | Shared across customers |
| Cost per customer | High | Low, and falls as you grow |
| Updates | Rolled out per customer, often on different versions | One deployment updates everyone |
| Data isolation | Physical: separate databases and often separate servers | Logical, enforced by the application and database (or partial physical separation) |
| Customisation | Deep, including custom code or versions | Configuration within shared code |
| Performance isolation | Strong; no neighbours | Requires throttling and fair-share controls |
| Compliance | Easier to satisfy strict data residency or isolation demands | Possible but needs careful design and evidence |
| Onboarding a new customer | Provision a new environment | Create a tenant record; often instant |
| Typical buyers | Large enterprises, regulated industries | SMBs and most SaaS customers |
In practice many SaaS companies offer both: a multi tenant product for most customers and dedicated (single tenant) deployments for large or regulated customers who pay for the extra isolation.
Types of Multi Tenant Architecture
AWS's SaaS guidance names three types of multi tenant architecture, based on how much infrastructure tenants share:
| Model | What's shared | Isolation | Cost efficiency | Operational complexity | Best for |
|---|---|---|---|---|---|
| Silo | Little or nothing: each tenant gets its own stack or database | Strongest | Lowest | High: many environments to deploy and monitor | Enterprise and regulated tenants |
| Pool | Everything: compute, databases and tables shared, rows tagged by tenant | Logical only | Highest | Lower to run, but isolation depends on code and policies | Many small and mid-size tenants |
| Bridge (hybrid) | Some layers pooled, others siloed, for example shared app servers with per-tenant databases | Mixed | Medium | Medium | Products with a mix of customer sizes |
Many products also offer tiered tenancy: free and standard plans in the pool, premium plans on dedicated databases or compute, and enterprise plans fully siloed.
Multi Tenant Database Architecture
The database is where the choice matters most. The four common patterns:
| Pattern | How it works | Pros | Cons |
|---|---|---|---|
| Shared database, shared tables | Every table has a tenant_id column; queries filter by it | Cheapest; simplest to operate at scale; easy cross-tenant analytics | One missing filter can leak data; heavy tenants affect others; per-tenant backup and restore is hard |
| Shared database, schema per tenant | Each tenant gets its own schema with identical tables | Stronger separation; per-tenant restore is easier | Migrations must run across many schemas; catalogue grows large |
| Database per tenant | Each tenant gets its own database on shared or separate servers | Strong isolation; per-tenant backup, restore and placement (for data residency) | More connections and operational overhead; schema migrations across many databases |
| Sharded pool | Tenants distributed across several pooled databases | Scales the pool horizontally; can move big tenants to their own shard | Routing layer and rebalancing add complexity |
For relational databases, a shared-table design is usually protected at two levels: the application always adds the tenant filter, and the database enforces it as a backstop. PostgreSQL's row level security, for example, can make the database itself refuse to return another tenant's rows:
ALTER TABLE invoices ENABLE ROW LEVEL SECURITY;
CREATE POLICY tenant_isolation ON invoices
USING (tenant_id = current_setting('app.tenant_id')::uuid);The application sets app.tenant_id for each request or transaction, and every query on invoices is filtered automatically. Our Postgres vs MySQL comparison covers why features like this influence database choice for SaaS.
How to Isolate Tenants
AWS's guidance is to define tenant identity first, because every isolation decision depends on it. A secure multi tenant design layers several controls:
- Tenant-aware identity. Every user belongs to a tenant, and the tenant ID travels in the authenticated session or token, never trusted from a request parameter alone.
- Authorization by tenant. Every data access checks both permissions and tenant ownership. Roles and attributes still apply within the tenant; our RBAC vs ABAC guide covers how to model those permissions.
- Data-layer enforcement. Database policies, separate schemas or databases, and tenant-scoped encryption keys add defence in depth.
- Scoped storage and caches. Object storage paths, cache keys, search indexes and message queues all include the tenant ID.
- Per-tenant encryption keys for sensitive customers, which also allows "crypto-shredding" a tenant's data by deleting its key.
- Testing for leaks. Automated tests that log in as tenant A and try to read tenant B's data, run on every change.
- Audit logs per tenant, so you can answer exactly who accessed what.
The Noisy Neighbour Problem
When resources are shared, one tenant's heavy usage can slow everyone else down: a giant report, a bulk import, or a misbehaving integration hammering the API. Common defences:
- Rate limits and quotas per tenant at the API gateway.
- Fair queuing for background jobs, so one tenant can't monopolise workers.
- Per-tenant resource limits in databases (connection pools, statement timeouts) and in compute.
- Moving heavy tenants to their own shard, database or compute pool when they outgrow the shared one.
- Per-tenant metrics, because you can't manage what you can't see: track usage, latency and errors by tenant.
Multi Tenant Architecture Example
Here's a multi tenant architecture example for a B2B project-management SaaS with 2,000 customers, most of them small, plus a handful of large enterprises.
| Layer | Design | Why |
|---|---|---|
| Web and API servers | Pooled, stateless containers behind a load balancer | Cheap and easy to scale for all tenants |
| Authentication | Shared identity service; each user belongs to one tenant; tenant ID in the access token | Tenant identity defined once and trusted everywhere |
| Database | Shared PostgreSQL cluster with tenant_id on every table and row level security; the 20 largest tenants on their own databases | Pool for efficiency, silo for heavy or regulated customers (bridge model) |
| File storage | One bucket with tenant-prefixed paths; enterprise tenants get dedicated buckets with their own keys | Simple for most, strong isolation for those who need it |
| Background jobs | Shared queue with per-tenant concurrency limits | Prevents one tenant's import from blocking others |
| Search | Shared index with tenant filter; separate index for enterprise tenants | Same pattern as the database |
| Deployments | One release for all tenants, with feature flags per tenant | Everyone gets fixes at once; new features can roll out gradually |
The result: most customers run in an efficient pool, while the few large customers who demand isolation pay for dedicated databases and storage, all from one codebase.
Multi Tenant Architecture Pros and Cons
Pros:
- Lower cost per customer, because infrastructure is shared and utilisation is higher.
- Simpler operations: one deployment, one version, one place to patch.
- Fast onboarding: a new tenant can be a database row, not a new environment.
- Economies of scale: improvements and capacity benefit every tenant at once.
- Easier analytics across the customer base (with appropriate consent and privacy controls).
Cons:
- Data leakage risk: a single bug in tenant filtering can expose one customer's data to another.
- Noisy neighbours: heavy tenants can degrade performance for others.
- All-or-nothing changes: an update or outage affects every tenant at once, so releases need good testing and gradual rollout.
- Compliance complexity: data residency, customer-managed keys and audit demands are harder in a pool.
- Limited customisation: tenants can configure but usually can't run their own code or version.
- Hard to change later: moving from one tenancy model to another usually means significant re-engineering, so plan isolation boundaries early.
How to Choose a Tenancy Model
- Start pooled if you're an early-stage SaaS with many small customers and no strict isolation requirements; it's cheapest and fastest to build.
- Design for a bridge by keeping tenant IDs everywhere and abstracting data access, so you can move a big customer to its own database later without rewriting the application.
- Offer silos as a premium tier for enterprises that require dedicated infrastructure, regional hosting or their own encryption keys, and price it accordingly.
- Go fully single tenant only if most customers demand it, as in some government or healthcare markets, and accept the higher cost per customer.
Common Mistakes
- Trusting the tenant ID from the client instead of deriving it from the authenticated session.
- Forgetting secondary stores: caches, search indexes, logs and file storage leak data as easily as the database.
- No per-tenant observability, so you can't see which tenant is causing load or errors.
- Global uniqueness assumptions, such as usernames or slugs that clash across tenants.
- Running migrations without tenant-scale testing, which can lock shared tables for everyone.
- Building single tenant by accident, with per-customer forks of the code that become impossible to maintain.
FAQ
What is an example of a multi tenant application?
Most SaaS products: CRM systems, project management tools, email marketing platforms and accounting software. All customers use the same application, while each sees only its own data.
Is multi tenant architecture secure?
It can be, with strong tenant-aware authentication, authorization on every request, data-layer enforcement such as row level security or separate databases, and testing for cross-tenant access. The risk is that a single bug can expose data across tenants, so isolation needs several layers.
What is the difference between single tenant and multi tenant SaaS?
Single tenant SaaS gives each customer dedicated infrastructure and often its own software instance. Multi tenant SaaS serves all customers from shared infrastructure and one deployment, separating them logically.
Which database design is best for multi tenancy?
It depends on scale and isolation needs. Shared tables with a tenant ID are cheapest and simplest for many small tenants; database-per-tenant gives the strongest isolation for fewer, larger tenants. Many products combine both.
Can I move from single tenant to multi tenant later?
Yes, but it's usually a major project, because tenant identity has to be added to every data access, cache and job. If you expect to need multi tenancy, build tenant awareness in from the start.