Shared tables vs database per tenant

Shared tables keep every tenant in one database and filter by tenant ID. A database for each tenant gives each tenant its own copy. For 100 small tenants at 2,000 requests/s, both give p99 near 27 ms. Shared tables cost 18 USD/mo. Separate databases cost 210 USD/mo, over the 80 USD/mo limit.

Play the level

A reader with no tools stops page ordersTap or press Space to add or remove the reader

Separate reader · 0 of 100 attacks reach a tool

A faster runtime needs fewer hostsArrow keys change the load. Tap or Space changes the runtime

1,500 req/s · Node API · 3 hosts · 18 USD/mo

Case 1

100 small tenants send 2,000 requests/s in total, with steady load. Errors must stay below 0.1 percent, p99 below 150 ms and cost below 80 USD/mo. The simulator does not score isolation.

Case 1
Measure Goal Shared tables with tenant ID A database for each tenant
Error rate under 0.1% 0% Pass 0% Pass
p99 latency under 150 ms 27 ms Pass 27 ms Pass
Monthly cost under 80 USD/mo 18 USD/mo Pass 210 USD/mo Fail
Monthly cost 18 USD/mo 210 USD/mo
HTTP/2SQLUsersLoad balanc…0.5 vCPU · 0.5 GBAPI server2 vCPU · 2 GBPostgres1 vCPU · 2 GB
HTTP/2HTTP/2SQLUsersLoad balan…API server2 vCPU · 2 GBPostgres1 vCPU · 2 GB
Shared tables with tenant ID: meets the goals
HTTP/2SQLUsersLoad balanc…0.5 vCPU · 0.5 GBAPI server2 vCPU · 2 GBPostgres
HTTP/2HTTP/2SQLUsersLoad balan…API server2 vCPU · 2 GBPostgres
A database for each tenant: misses a goal