Skip to content

System design

Think in Systems.Build for Scale.

Learn how real systems behave under load, failure, and growth.

Start LearningExplore Interactive Labs

Requests pass a load balancer to the API tier. The API reads through a cache and writes to a database. Move the traffic slider to see what gives way first.

8,000 req/s
0.3 ms0.2 ms0.5 ms0.5 msClientsHealthy<1%Load balancerHealthy<1%APIHealthy9%CacheHealthy7%DatabaseHealthy10%
0.3 ms0.2 ms0.5 ms0.5 msClientsHealthy<1%Load balancerHealthy<1%APIHealthy9%CacheHealthy7%DatabaseHealthy10%

Each dot stands for many requests. The numbers show the real rate.

No bottleneck: every component has headroom.

0 ms
Metrics
ComponentStateUtilisationOffered (req/s)Served (req/s)Rejected (req/s)p50p95p99
ClientsHealthy<1%8K8K00 ms0 ms0 ms
Load balancerHealthy<1%8K8K00.03 ms0.15 ms0.23 ms
APIHealthy9%8K8K00.97 ms4.2 ms6.4 ms
CacheHealthy7%7.2K7.2K00.01 ms0.03 ms0.05 ms
DatabaseHealthy10%1.4K1.4K01.5 ms6.6 ms10 ms
Traffic
8,000 req/s
Successful
8,000 req/s
Error rate
0%
Mean latency
2.4 ms

Illustrative values, not benchmarks of any real product.

Model notes

Assumptions

  • Requests arrive at random, as a Poisson process, at a constant average rate.
  • Each node is one queue, served first-come first-served by several identical slots (instances × concurrency).
  • Service times are random with the stated mean; by default they are exponentially distributed.
  • Each node is analysed separately, with the traffic it receives treated as Poisson.
  • Nine in ten requests are reads. The cache holds the key for 92% of them; the rest, and every write, go to the database.

Simplifications

  • Above capacity there is no steady state. The model switches to a fluid approximation: the node serves at capacity, its queue grows until it reaches its limit, and further requests are rejected.
  • Percentiles assume an exponential tail. A service-time variability other than exponential changes the mean wait but not the shape of the tail.
  • A node frees its slot as soon as it has done its own work, before waiting on the services it calls. Real thread-per-request servers hold the slot, so a slow dependency exhausts them faster than this model shows.
  • A request calls its dependencies one after another. Parallel fan-out is not modelled.
  • When a caller times out and gives up, the callee still finishes the work, so abandoned requests keep consuming capacity.
  • Retries add load. Their backoff and jitter decide when that load arrives, which only the per-request simulation shows.
  • Retry feedback is solved from the healthy starting point, so it finds one stable outcome. Systems that stay stuck in overload after the cause is gone are not shown.
  • A throughput limit (for example maximum writes per second) is modelled as slower service, not as a separate rate limiter.
  • A caller’s timeout counts the mean time its dependencies take, not their full distribution.
  • Reads and writes share the database's capacity. Real databases treat them differently, and writes are usually the scarcer resource.

Parameter values are illustrative. They are not benchmarks of any real product.

Built by GhaziAlibi.

© ShardCraft. All rights reserved.