failover
← All labs

Medium · 12 steps · ~60 min

Design a multi-tenant SaaS platform

Share one platform between hundreds of customers without letting any of them hurt the others.

A software company serves hundreds of customers (tenants) from one platform. Sharing is what keeps it affordable, but one tenant's traffic spike or data-hungry job must not slow everyone else, and no tenant may ever see another's data.

Same problem as SalesforceShopifySlack

How it works

What you'll build

  1. A tenant-aware API and data model
  2. A gateway and cache for the shared path
  3. A rate limiter that stops a noisy neighbour
  4. Sharding by tenant and isolation tiers
  5. Cheap background compute, and surviving a cold cache and a lost primary

Steps

  1. 1Design the API
  2. 2Design the data model
  3. 3Serve 1,500 requests per second
  4. 4Add a gateway and cache at 10,000 requests per second
  5. 5Stop a noisy neighbour at 90,000 requests per second
  6. 6Global limit or per-tenant limit?
  7. 7Shard by tenant at 40,000 requests per second
  8. 8Isolation tiers
  9. 9Run tenant background jobs cheaply
  10. 10Survive a cold cache at 12,000 requests per second
  11. 11Lose the primary database
  12. 12Deep dive: preventing cross-tenant leaks
Start the lab →