software architecture

Multi-Tenant SaaS Architecture: Shared, Siloed, or Hybrid?

The tenancy model is an early, hard-to-reverse decision that touches every query you write. Shared (one DB, tenant_id per row), siloed (a DB per tenant), and hybrid (shared for the long tail, siloed for enterprise) — the isolation/cost/complexity trade-off, the data-isolation and noisy-neighbor traps, per-tenant cost visibility, and why most startups should start shared but build the routing seam to earn their way to hybrid.

Ruchit Suthar

Ruchit Suthar

15+ years scaling teams from startup to enterprise. 1,000+ technical interviews, 25+ engineers led. Real patterns, zero theory.

12 min read
Multi-Tenant SaaS Architecture: Shared, Siloed, or Hybrid?
Key Takeaway

The tenancy model — how you isolate one customer's data and load from another's — is one of the earliest and hardest-to-reverse decisions you'll make in a B2B SaaS. Get it wrong and you're facing a data-leak incident, a noisy-neighbor outage, or a migration that eats a year. Three models: shared (one database, a tenant ID on every row), siloed (a database or schema per tenant), and hybrid (shared by default, siloed for the customers who demand it). This is the decision framework: the isolation/cost/complexity trade-off, the noisy-neighbor and data-isolation traps, per-tenant cost visibility, and why most startups should start shared and earn their way to hybrid.

Multi-Tenant SaaS Architecture: Shared, Siloed, or Hybrid?


A SaaS founder once asked me to review their architecture before a big enterprise deal. The deal required a security questionnaire, and one question stopped them cold: "Is our data physically isolated from other customers?" Their honest answer was no — every tenant shared one database, separated only by a tenant_id column. The enterprise buyer wanted a database of their own. The founders had built the entire system on the assumption of full sharing, and now retrofitting per-tenant isolation looked like a six-month rewrite blocking a seven-figure contract.

The opposite mistake is just as common. Another team gave every tenant their own database from day one because it "felt safer." At 2,000 tenants they had 2,000 databases to migrate on every schema change, 2,000 sets of credentials to rotate, and a per-tenant cost so high that small customers were unprofitable. Their isolation was airtight and their operations were on fire.

Both teams made the same underlying error: they picked a tenancy model by instinct instead of by the forces. The tenancy decision sits near the bottom of your stack, touches every query you write, and is brutally expensive to change later. It deserves a real framework.

The three models

Tenancy is fundamentally about isolation: how strongly is one customer's data and runtime behavior separated from another's? The three models are points on that spectrum.

Shared (pooled) — one database, tenant_id everywhere

All tenants live in the same database and tables; a tenant_id column on every row (and every query's WHERE clause) separates them.

  • Pros: cheapest by far (one database to run, patch, back up), simplest operations, trivial to onboard a new tenant (insert a row), and efficient resource use — idle tenants cost almost nothing.
  • Cons: weakest isolation. One missing WHERE tenant_id = ? is a cross-tenant data leak. Noisy neighbors share resources. "Physical isolation" for compliance is impossible.
  • Best for: early-stage SaaS, many small tenants, cost-sensitive products, self-serve B2B.

Siloed (isolated) — a database or schema per tenant

Each tenant gets its own database (or at least its own schema). Strong walls between customers.

  • Pros: strong isolation (a query can't accidentally cross tenants), easy per-tenant backup/restore and data residency, no noisy-neighbor at the data layer, and an easy "yes" to the enterprise security questionnaire.
  • Cons: expensive and operationally heavy — N databases to migrate, monitor, back up, and secure. Schema changes become fleet operations. Per-tenant fixed cost makes small customers unprofitable. Onboarding requires provisioning.
  • Best for: regulated industries, a smaller number of large/enterprise tenants, strict data-residency or isolation requirements.

Hybrid — shared by default, siloed on demand

Most tenants share a pooled database; specific tenants (the ones who pay for or require it) get a dedicated database. You run both models behind one application.

  • Pros: the long-pole answer. Cheap economics for the long tail of small customers, strong isolation for the enterprise customers who demand and fund it. Lets you say yes to the seven-figure deal without making every tenant expensive.
  • Cons: the most engineering complexity — your data-access layer must route each tenant to the right place, and you operate two models at once.
  • Best for: maturing SaaS with a mixed customer base (many small + a few large) — which most successful B2B SaaS eventually becomes.

The two traps that cause incidents

Trap 1: Data isolation in the shared model

In the shared model, tenant isolation is enforced by your application code remembering to filter by tenant_id on every single query. That is a terrifying thing to rely on human discipline for. One forgotten filter in one endpoint, and Customer A sees Customer B's data — a breach that ends enterprise deals and trust.

Do not rely on developers remembering. Enforce isolation at a layer below the individual query:

  • Row-Level Security (RLS): databases like PostgreSQL can enforce, at the engine level, that a session only ever sees rows matching its tenant. Even a query that forgets the WHERE returns only the right tenant's rows. This is the single most important safety mechanism for shared multi-tenancy.
  • A mandatory tenant scope in the data layer: a repository/ORM layer that automatically injects the tenant filter, so an unscoped query is impossible to write by accident.
  • Tests that actively try to cross tenants: a test suite that asserts Tenant A literally cannot read Tenant B's data, run on every change.

The principle: make the safe thing automatic and the unsafe thing impossible, rather than asking every engineer to be perfect on every query forever.

Trap 2: Noisy neighbors

In pooled models, tenants share compute, connections, and database resources. One tenant running a monster report, a bulk import, or an accidental infinite loop can degrade performance for everyone. Your most important customer's experience tanks because of something a free-tier tenant did.

Defenses: per-tenant rate limits and quotas, connection pool limits per tenant, isolating heavy/batch work onto separate workers so it can't starve interactive traffic, and monitoring that attributes load to a tenant so you can spot and throttle the offender. The hybrid escape hatch also applies — a chronically noisy big tenant is a candidate to move to a dedicated silo.

Don't forget per-tenant cost visibility

A subtle but business-critical point: in any multi-tenant system you need to know what each tenant costs you to serve. Without per-tenant cost attribution, you can't tell which customers are profitable, which are subsidized, and how to price tiers. This is easy to bolt on early (tag resources, attribute query/compute load to tenants) and painful to reconstruct later. The team with 2,000 unprofitable databases didn't discover the problem until it was structural — because they had no per-tenant cost view until far too late.

The decision framework

My default advice for most startups: start shared, but build the tenant-routing seam from day one. The expensive mistake isn't choosing shared — it's choosing shared in a way that hardwires the assumption everywhere, so you can't introduce a silo when the enterprise deal arrives (the founder from the opening story). If your data-access layer already resolves "where does this tenant live?" in one place, evolving shared → hybrid is a feature, not a rewrite. This is the same reversibility principle that governs every good architecture decision: pick the simple option, but keep the door open.

What to do Monday morning

  1. Write down your current tenancy model and the assumption it bakes in. Can you give one tenant a dedicated database without a rewrite? If not, that's your latent enterprise-deal blocker.

  2. If you're shared, audit isolation enforcement. Is tenant_id filtering enforced by RLS or an automatic data-layer scope — or by developers remembering? If it's the latter, you have an unexploded data-leak. Add RLS and cross-tenant tests.

  3. Add per-tenant load attribution and rate limits. Can you tell which tenant is causing a slowdown, and throttle them? If a single tenant can degrade everyone, prioritize quotas and pool limits.

  4. Confirm you can answer "what does each tenant cost us?" If not, add cost attribution now — it's cheap today and structural to retrofit.

  5. Capture the decision in an ADR. Tenancy is exactly the kind of hard-to-reverse choice future engineers will need the why for.

Key takeaways

  • Tenancy is an early, hard-to-reverse decision that touches every query. Choose by the forces — isolation needs, customer mix, cost sensitivity — not by instinct. Both over-sharing and over-isolating cause expensive failures.

  • Three models on an isolation spectrum: shared (cheap, simple, weakest isolation), siloed (strong isolation, expensive and operationally heavy), hybrid (shared for the long tail, siloed for enterprise — where most successful SaaS lands).

  • Never rely on developers remembering tenant_id. Enforce isolation below the query with Row-Level Security and an automatic tenant scope, and test that tenants literally cannot read each other's data. A single forgotten filter is a breach.

  • Design for noisy neighbors and per-tenant cost. Pooled models need rate limits, quotas, and load attribution so one tenant can't degrade everyone; and you must know what each tenant costs to serve to price and profit correctly.

  • Start shared, but build the routing seam. For most startups, the right move is the cheap shared model implemented so that adding a dedicated silo later is a feature, not a rewrite. Keep the door to hybrid open from day one.

Your next step

Ask one question about your SaaS: "Could we give our biggest prospective customer a dedicated, physically isolated database next month — without a rewrite?" The answer reveals whether your tenancy model is an asset or a future emergency. If it's "no," you don't necessarily need to migrate today — but you do need the routing seam that makes migration possible, before the enterprise deal that demands it lands on your desk. The best tenancy architecture isn't the most isolated or the cheapest. It's the one that can change as your customers do.

Frequently asked questions

What are the main multi-tenant SaaS architecture models?

There are three. Shared (pooled): all tenants share one database and tables, separated by a tenant_id column — cheapest and simplest, but weakest isolation. Siloed (isolated): each tenant gets its own database or schema — strong isolation and easy compliance, but expensive and operationally heavy. Hybrid: most tenants share a pooled database while specific enterprise tenants get dedicated databases — combining cheap economics for small customers with strong isolation for those who require it. Most successful B2B SaaS eventually adopts a hybrid model.

Should a startup use a shared or separate database per tenant?

Most startups should start with a shared database, because it's the cheapest and simplest to operate and onboard into, especially with many small or self-serve customers. The important caveat is to build the tenant-routing seam from day one — a data-access layer that resolves where each tenant's data lives in one place — so you can later move specific tenants to dedicated databases (evolving to hybrid) without a rewrite. Start siloed or hybrid immediately only if you have hard compliance, data-residency, or physical-isolation requirements from the outset.

How do I prevent cross-tenant data leaks in a shared database?

Do not rely on developers remembering to filter every query by tenant_id. Enforce isolation below the individual query: use database Row-Level Security (RLS) so a session can only ever see its own tenant's rows even if a query omits the filter, add a data-access layer that automatically injects the tenant scope so unscoped queries can't be written, and run tests that actively assert one tenant cannot read another's data. The goal is to make the safe path automatic and the unsafe path impossible.

What is the noisy neighbor problem in multi-tenant systems?

The noisy neighbor problem occurs in pooled (shared) models when one tenant consumes a disproportionate share of shared resources — for example by running a huge report, a bulk import, or a runaway query — and degrades performance for all other tenants. Mitigate it with per-tenant rate limits and quotas, per-tenant connection pool limits, isolating heavy or batch workloads onto separate workers, and monitoring that attributes load to specific tenants so you can identify and throttle the offender. A chronically noisy large tenant is also a candidate to move to a dedicated silo.

When should a SaaS move from shared to dedicated (siloed) tenancy?

Move a tenant (or move to a hybrid model) when a specific customer requires physical data isolation or data residency for compliance, when an enterprise deal's security requirements demand a dedicated database, or when a large tenant's load consistently causes noisy-neighbor problems for others. You typically don't migrate everyone — you introduce dedicated silos for the tenants that need or fund them while keeping the long tail of small customers in the shared pool, which is the hybrid model. This is far easier if you built a tenant-routing layer from the start.

#software-architecture#multi-tenancy#saas#data-architecture#row-level-security#scalability#b2b-saas#system-design
Ruchit Suthar

Ruchit Suthar

15+ years scaling teams from startup to enterprise. 1,000+ technical interviews, 25+ engineers led. Real patterns, zero theory.

Continue Reading

Common Software Architecture Mistakes and How to Avoid Them
software architecture

Common Software Architecture Mistakes and How to Avoid Them

The same architectural mistakes repeat across hundreds of systems: premature microservices, tight coupling, ignoring operational concerns, and skipping documentation. These compound quickly—companies with architectural debt spend 60-80% of engineering time on maintenance. Learn the patterns, decision frameworks, and practical fixes.

·12 min read
Common System Architectures: A Reference Catalog Every Architect Should Know (With Diagrams and Code)
software architecture

Common System Architectures: A Reference Catalog Every Architect Should Know (With Diagrams and Code)

A practical reference catalog of the eight architectures worth knowing — layered, modular monolith, hexagonal, event-driven, CQRS + event sourcing, microservices, serverless, and the strangler fig. Each with a diagram, the forces that make it the right call, the failure mode that makes it the wrong one, and a link to runnable reference code. Plus a decision flowchart so you pick on fit, not hype.

·18 min read
Designing LLM-Powered Features: RAG, Vector Databases, and the New System-Design Checklist
software architecture

Designing LLM-Powered Features: RAG, Vector Databases, and the New System-Design Checklist

Adding an LLM to your product is a distributed-systems problem with a non-deterministic dependency, not a single API call. When RAG actually helps (and when a prompt will do), how to think about vector databases and chunking without cargo-culting, the retrieval pipeline that separates demos from products, and the seven-point production checklist — evals, guardrails, cost ceilings, latency budgets, fallbacks, observability, and a human-in-the-loop boundary — to put in place before a real user touches it.

·15 min read