Multi-Tenant Architecture in SaaS: Isolation Models, Security and Scaling
A practical guide to multi-tenant architecture in SaaS: compare silo, bridge and pooled models, design tenant-aware identity and data access, and prevent cross-tenant leaks across databases, APIs, caches, storage and background jobs.

Multi-Tenant Architecture in SaaS: Isolation Models, Security and Scaling
Multi-tenant cloud applications serve multiple customer organisations from a shared software platform while keeping each customer's data, configuration and permissions separate. An application may share its code, runtime, database or infrastructure; it does not have to share every component.
That is the central design decision in multi-tenant architecture: decide what can be shared, define where each tenant's boundary lives, and enforce it in every layer a request touches. Sharing can reduce infrastructure and maintenance costs, but it makes isolation and resource fairness critical. A missing tenant check can expose another customer's data; a busy tenant can consume capacity used by others.
A tenant is not the same as a user
A tenant is the customer boundary that owns data and configuration. In B2B SaaS, that is often a customer organisation. One tenant can contain many users, and a user may belong to more than one tenant.
Model these concepts separately:
- Tenants represent organisations, workspaces or other ownership boundaries.
- Users represent authenticated people or service identities.
- Memberships connect users to tenants and hold tenant-specific roles or status.
- Business records belong to a tenant, directly or through a defined ownership relationship.
SaaS and multitenancy are related, but they are not synonyms. SaaS is a delivery model; multitenancy is an architectural approach in which some components are shared across tenants. A SaaS product can use dedicated deployments, shared deployments or a mixture. Microsoft explains the distinction in its architecture guidance.
The three common tenancy models
AWS uses three useful labels for common SaaS isolation patterns: silo, bridge and pool. They describe points on an isolation spectrum, not a universal standard. Real systems combine patterns across application, compute and data layers. Microsoft similarly describes isolation as a continuum from shared resources to dedicated infrastructure.

Illustration: Three common SaaS tenancy patterns. A production system can combine patterns at different layers.
| Model | What is shared | Where separation lives | Main trade-off |
|---|---|---|---|
| Silo | Little or nothing; each tenant has dedicated resources | Separate application, database or infrastructure | Stronger resource separation, more operational work |
| Bridge | Selected components, often the application tier | Separate schemas, databases or dedicated components | Middle ground, more migration and deployment complexity |
| Pool | Application and database resources | Tenant identifiers, access policies and row-level controls | Efficient to operate, but depends on consistent enforcement |
Silo: dedicate resources to a tenant
A silo gives each tenant a dedicated set of resources: a separate database, application deployment or infrastructure stack. It can suit customers with strict contractual, regulatory, data-residency or performance requirements.
The cost is operational. More environments mean more provisioning, upgrades, monitoring and backups. Dedicated infrastructure does not make an application automatically secure; identity, access control and patching still matter.
Bridge: share some layers and isolate others
A bridge shares selected components while dedicating others. One example is a shared application tier connected to a separate database for each tenant; another is a shared database server with a separate schema per tenant.
This provides a stronger data boundary without duplicating the whole application. The cost is orchestration: schema-per-tenant designs need coordinated migrations, while database-per-tenant designs need connection, backup and migration management. Document which components are shared rather than relying on the label alone.
Pool: share the application and database
In a pool, tenants share application and database resources. Rows carry a tenant key, commonly tenant_id, and the application and database enforce which rows each tenant can access.
This works well when customers use similar features and the service needs one main deployment path. The risk is that isolation becomes a property of the code and data-access design. A query that forgets its tenant condition, an incorrectly scoped cache key or a background job without tenant context can cross the boundary.
Make tenant context part of every request
A request should not reach tenant-owned data until the server has established which tenant the authenticated user is allowed to act within.
- Authenticate the identity by verifying the session or token.
- Resolve the active tenant from a verified claim, mapped subdomain or explicit tenant route.
- Check membership and tenant status.
- Bind validated tenant and user information to request-scoped context.
- Enforce that context in repositories, database policies, caches, file access and asynchronous jobs.
Do not treat a tenant ID supplied in a header, query parameter or URL as proof of permission. A client may send a tenant selector, but the server must verify membership. A UUID or unguessable slug is not an authorisation mechanism.

Illustration: Tenant context must be validated before access and remain enforced across downstream resource paths.
The OWASP Multi-Tenant Security Cheat Sheet recommends establishing tenant context early, binding it to the authenticated session and propagating it through application layers. It also identifies tenant-context injection and insecure direct object references as risks.
Enforce tenant boundaries in the database
Application code should scope every tenant-owned query. For example, a project lookup should check both the resource identifier and its tenant:
SELECT id, name
FROM projects
WHERE id = $1
AND tenant_id = $2;A tenant-scoped repository can make validated context mandatory for data access. Composite keys and constraints can also help prevent records from being linked across tenants accidentally.
PostgreSQL Row-Level Security (RLS) adds another enforcement layer. When RLS is enabled, normal row access must be allowed by a policy; if no policy exists, PostgreSQL uses default-deny behaviour. A simplified policy for a shared projects table could look like this:
ALTER TABLE projects ENABLE ROW LEVEL SECURITY;
ALTER TABLE projects FORCE ROW LEVEL SECURITY;
CREATE POLICY projects_tenant_policy
ON projects
USING (
tenant_id = NULLIF(
current_setting('app.current_tenant', true),
''
)::uuid
)
WITH CHECK (
tenant_id = NULLIF(
current_setting('app.current_tenant', true),
''
)::uuid
);Set the validated tenant context inside the same database transaction as the queries that use it:
BEGIN;
SELECT set_config('app.current_tenant', $1, true);
-- Run tenant-scoped queries in this transaction.
COMMIT;When the third argument to set_config is true, PostgreSQL applies the setting only for the current transaction. Test the transaction and pool behaviour in the application's own stack.
RLS has limits. PostgreSQL documents that superusers and roles with BYPASSRLS always bypass row security. Table owners normally bypass it too, unless row security is forced for the table. Use a restricted application role, not a table owner or superuser, and keep migration privileges separate. FORCE ROW LEVEL SECURITY does not override superuser or BYPASSRLS privileges.
The SQL is illustrative, not a drop-in migration. Adapt it to the actual schema and role model, then test it with the same database role the application uses. See the PostgreSQL row security documentation and configuration-setting functions.
Isolation must extend beyond database queries
A database filter is not enough if another layer can return data from the wrong tenant.
- Caches: Include the tenant identifier in cache keys and validate tenant ownership when reading cached data.
- File storage: Use tenant-aware paths or containers, enforce access policies and verify ownership before issuing a download or signed URL. A tenant prefix alone is not an access-control policy.
- Background jobs: Carry tenant context with the job, validate the message source and check permissions again when the worker performs the operation.
- APIs and quotas: Apply tenant-aware rate limits so one customer cannot consume all shared capacity.
- Logs and lifecycle: Record tenant and acting identity for relevant operations; define how tenant resources, files, cache entries and keys are created, exported, retained or deleted.
OWASP identifies cache, storage, queue and lifecycle weaknesses as multi-tenant risks and recommends tenant-specific controls across those layers.
Scale without rebuilding the product
A tenant registry can map each tenant to the deployment, database or region that holds its data. Most customers might remain on a shared application and database, while selected customers use a dedicated database or deployment. The application resolves the tenant and routes the request to the correct location.
Microsoft's Azure guidance describes mapping tenants to deployments and using mixed or partitioned deployments. It also notes that a large tenant's workload can affect others, and a failure in shared infrastructure can affect the whole group.
Track usage by tenant, set quotas and identify which resource is under pressure before isolating an entire customer. If a database is the bottleneck, a dedicated database may help; if a worker pool is the bottleneck, compute isolation or fair scheduling may be more relevant.
Test the isolation model, not just the happy path
Every tenant-aware feature should have negative tests that attempt to cross the boundary.
| Surface | Test to include |
|---|---|
| API and object IDs | Tenant A requests a resource owned by Tenant B |
| Database | Missing tenant context denies access; the application role cannot bypass RLS |
| Cache | Two tenants with the same local identifier never share an entry |
| File storage | Tenant A cannot retrieve Tenant B's object by changing a path or ID |
| Background jobs | A job for Tenant A cannot be altered to operate on Tenant B's data |
| Administration | Cross-tenant support access requires an explicit, audited privilege |
| Lifecycle | Offboarding handles every category of tenant data |
Run these checks after changes to authentication, database policies, caching, storage, queue consumers and administrative tooling. Test migrations and restores too. Microsoft explicitly recommends testing the selected isolation model for cross-tenant leaks and unacceptable noisy-neighbour effects.
AI features need the same rule. An agent should not become a privileged route around the tenant boundary. Tool calls should use the same server-side identity and authorisation checks as ordinary application requests; a system prompt is not an access-control mechanism.
How to choose the right model
There is no universal winner. Choose the isolation level against actual requirements:
- Pool when customers have similar needs and tenant scope can be enforced consistently.
- Bridge when selected data stores or services need stronger isolation without duplicating the whole application.
- Silo when contracts, compliance, residency, customisation or workload isolation justify the extra operational cost.
- Hybrid when most customers can share resources but a smaller group needs dedicated components.
The decision should account for security, compliance, performance, reliability, cost and operational capacity. Do not choose a pooled design only because it is cheaper, or a silo design only because it sounds more secure. Define the boundary, enforce it at every layer and test the failure cases.
Further reading
AI-assisted content
This story was drafted and/or edited with AI assistance and reviewed before publishing.
Explore more topics
Related stories

OpenAI and Cisco Launch Shirudo, an Experimental Runtime Shield for Linux
OpenAI and Cisco have open-sourced Shirudo, a project designed to deploy temporary protections while teams prepare software patches. Its first public demonstration is narrow, and the project’s own documentation says it is not ready for production.

