Architecture

Multi-tenant web apps

The tenancy model decides your margin, your blast radius and how hard the next security questionnaire is. It is worth getting right before you have two hundred customers on it.

Pool / silo / bridgePer-tenant limitsBlast radius

What is a multi-tenant architecture?

A multi-tenant architecture serves many customers from one deployment, with each tenant's data kept separate by the application rather than by running a separate stack. On AWS the separation is done three ways: pool, silo, or a bridge that mixes both per data store.

The problem

One shared pool works until it does not

A single customer runs an unbounded query, saturates the connection pool, and everyone else sees timeouts. The fix after the fact is an emergency. The same limits put in beforehand are an afternoon of work.

3
tenancy models
p99
tracked per tenant
1
tenant cannot take the rest down
What you get

Included in the engagement

Model selection per data store

Shared tables for the cheap high-volume data, dedicated stores for the customers who pay for it and ask about it. Mixing is normal and usually correct.

Row-level and schema-level separation

Enforced in the data layer rather than trusted to every query an engineer will write in the next two years.

Quotas and throttles

Per-tenant request rates, query timeouts and job concurrency, with headroom set from real traffic instead of a round number.

Tenant-aware observability

Logs, traces and dashboards filterable by tenant, so 'is it us or is it them' takes a minute rather than an afternoon.

How it runs

How the isolation work runs

One data store at a time. Products rarely want the same answer everywhere.

  1. Store-by-store review

    List the data stores and choose an isolation model for each one separately, rather than picking a single model for the product.

  2. Enforce separation

    Row-level policies, separate schemas or separate stores, enforced where the query runs and not in application code alone.

  3. Quotas and throttles

    Per-tenant limits on the paths that can be abused, with the limit visible to support before a customer has to report it.

  4. Tenant-aware observability

    Tenant id on logs, metrics and traces, so the question of whether it is everyone or one customer takes a minute to answer.

  5. Prove it in CI

    A test that one tenant cannot read another, running on every build, so the answer in a security review is a test result rather than an assurance.

Comparison

Pool, silo and bridge compared

The choice is per data store, not per product, and it is reversible if the tenant abstraction goes in first.

Pool, silo and bridge compared
DimensionPoolSiloBridge
Data layoutOne shared store, tenant id on every rowOne store per tenantShared for most data, dedicated for what a customer asks about
Cost per tenantLowest, capacity is sharedHighest, every tenant pays for its own idleIn between, and you choose which tenants cost more
Blast radiusOne bad query can reach every tenantOne tenant onlyLimited to the pool, siloed tenants unaffected
Isolation in a security reviewEnforced in code, needs explainingSeparate stores, easy to explainAnswer differs per store, so document it per store
Onboarding a tenantInsert a rowProvision a stackInsert a row, or provision, depending on plan
Patching and schema changeOne placeEvery tenant environmentOne place, plus the siloed few
Usually right forThe bulk of your customersThe regulated or very large onesA book with both kinds in it
Fit

Who this is for

If none of these sound like you, say so on the call and we will tell you honestly whether this is the right piece of work to start with.

  • One customer's traffic has already caused an incident for everyone else.
  • You are about to sign a customer far larger than the rest of the book.
  • Nobody can currently answer 'what does this account cost us to run'.
Questions

Asked before every engagement

Anything missing, email [email protected].

Which model should we pick?

Pool for most things, silo for the data a large customer will ask about by name, bridge when you have both kinds of customer. The choice is per data store, not per product, and it is reversible if you build the abstraction first.

What is the difference between pool, silo and bridge?

Pool shares one store across all tenants and separates rows by tenant id. Silo gives every tenant its own store. Bridge pools the high-volume data and silos the parts a customer will ask about. Pool is cheapest, silo is easiest to explain to an auditor.

How do you stop one tenant affecting the others?

Per-tenant request rates, query timeouts and job concurrency caps, with the ceilings set from real traffic rather than a round number. Add a connection cap so a single customer cannot take the whole pool.

How is tenant isolation enforced in the database?

In the data access layer, not in every query an engineer writes over the next two years. Row-level security or a scoped client that cannot issue an unqualified query is what survives staff turnover.

Can we prove isolation to an enterprise buyer?

That is what the model choice is for. With silo you point at separate stores. With pool you show the enforcement point, the tests around it, and the audit trail of access per tenant. Both answers work if they are written down before the questionnaire arrives.

How do you work out what one tenant costs to run?

Tagging plus usage metering at the point work happens, so shared spend gets attributed rather than divided by headcount. It is the report that tends to change pricing conversations.

Send us your AWS bill

Thirty minutes with an engineer, no slide deck. We will tell you what we would change first and what it would cost to have us do it.

Talk to an engineer