SHEET · 07-SHARD-THE-DATABASE

Shard the Database

One database can't keep up. Add a load balancer in front of multiple servers, then a shard router that deterministically partitions writes across multiple databases by key. More shards = more aggregate throughput.

SLA · success ≥ 90.0% · p95 ≤ 800 ms · load ~2800 req/s
📖 CONCEPT← DRAWING SET
Add a client — every system needs somewhere for traffic to come from.
PARTS · CATALOG
Components
Drag onto the sheet, or click to add. Hover any item for details.
COMPUTE
👤 Client
A client represents the users (or other systems) hitting your service. In Flow, every tick each client fires off a batch of requests into the system.
Think: people pressing 'Send' in an app.
LatencyHow long this component spends handling each request. ≈ 0 ticks in simulation time. Jitter ±0% adds realistic variation.0 ms
CapacityMax requests this component can work on at the same time. no concurrency limit, derived from capacity ÷ latency. If more requests arrive than this, they get dropped.unbounded
🖥️ Server
A server takes in a request, does work for a few milliseconds, then hands it off (to a database, cache, or back to the client). It can only handle so many requests at the same time — its capacity.
Think: a barista. Fast, but only one drink per hand at a time.
LatencyHow long this component spends handling each request. ≈ 3 ticks in simulation time. Jitter ±20% adds realistic variation.30 ms
CapacityMax requests this component can work on at the same time. ≈ 2667 req/s sustained, derived from capacity ÷ latency. If more requests arrive than this, they get dropped.80 concurrent
ROUTING
⚖️ Load Balancer
A load balancer accepts incoming requests and forwards each to one of several downstream servers. Its fan-out policy decides which server to pick (round-robin, random, or least-loaded).
Think: the host at a restaurant deciding which waiter takes the next table.
LatencyHow long this component spends handling each request. ≈ 1 tick in simulation time. Jitter ±5% adds realistic variation.10 ms
CapacityMax requests this component can work on at the same time. ≈ 50000 req/s sustained, derived from capacity ÷ latency. If more requests arrive than this, they get dropped.500 concurrent
🔀 Shard Router
A shard router splits traffic deterministically: the same request id always lands on the same downstream. This lets you scale past a single database's limits — each shard owns a slice of the keyspace and runs at its own capacity. Trade-off: queries that span shards need a separate aggregation step.
Think: assigning library books by author surname. A–F to one shelf, G–M to another. Anyone searching always knows which shelf to check.
LatencyHow long this component spends handling each request. ≈ 1 tick in simulation time. Jitter ±5% adds realistic variation.10 ms
CapacityMax requests this component can work on at the same time. ≈ 40000 req/s sustained, derived from capacity ÷ latency. If more requests arrive than this, they get dropped.400 concurrent
DATA
🗄️ Database
A database persists data so it survives restarts. Reads and writes take longer than in-memory work, and databases handle fewer concurrent requests than servers, which makes them a common bottleneck.
Think: a filing cabinet. Reliable, but slower than your desk drawer.
LatencyHow long this component spends handling each request. ≈ 4 ticks in simulation time. Jitter ±15% adds realistic variation.40 ms
CapacityMax requests this component can work on at the same time. ≈ 3000 req/s sustained, derived from capacity ÷ latency. If more requests arrive than this, they get dropped.120 concurrent
Mini Map
Select a node to inspect it.
Press Validate or Run Simulation to see results.