Skip to main content
PRISM
Loading the canvas

How to get something out of this

The canvas rewards a specific habit, and it is the same habit that makes a system design interview go well: predict before you run. Look at the design, decide which component you think gives way first and at roughly what load, and only then press the button. Being wrong is the useful outcome — it is the moment a piece of intuition gets corrected, and it costs about a minute.

Then turn the traffic up. Not to a number you chose in advance, but slowly, watching the utilisation bars, until something goes red. That number is the design's capacity, and it is almost never the number the arithmetic suggested, because the arithmetic does not include queueing.

What the simulation actually does

Requests enter at a client and walk the graph. At each component they are served immediately if there is a free slot, wait if there is not, and are rejected if the queue is full. Service times are log-normal, so some requests are much slower than the median — which is what creates queues at loads well below capacity. Latency accumulates along the whole path, including the waiting, which is the part a boxes-and-arrows diagram cannot show.

A cache returns immediately on a hit and passes the miss downstream. A client with retries configured will re-send what fails, and if you have not given it jittered backoff, that amplification is real and will show up in the offered-load chart as a spike that arrives exactly when the system can least take it.

Things worth trying

  • Run a design at its designed load, then at twice it. The failure is rarely proportional.
  • Kill the database mid-run and watch how far the damage spreads. Then give the service a cache and do it again.
  • Set a client to three retries with no backoff, then kill something. That is a retry storm inside your own drawing.
  • Add replicas to whatever the bottleneck is until something else becomes the bottleneck. Every design has a next constraint, and knowing what it is is most of capacity planning.

Starting points, each with a flaw

Every template is a common interview prompt drawn the way a candidate draws it in the first ten minutes: mostly right, with one thing that shows up the moment it runs. A template that already worked would teach nothing.

  • URL shortener

    Design a URL shortener. 100 million new links a day, 10 billion redirects a day, redirects must be fast.

    The read path goes straight to the database. At redirect volume that is thousands of queries a second against a store sized for writes — put a cache in front of it and watch the origin load collapse.

  • News feed

    Design a social feed. 100 million daily users, average 200 followers, feed must load in under 200ms.

    Fan-out on read: every feed load queries the post store for every followed account. The database is the bottleneck within seconds, and no amount of application replicas helps.

  • Chat system

    Design a chat system. 50 million daily users, messages delivered in under a second, history preserved.

    The message store takes every write synchronously on the delivery path. Put a queue between them and delivery stops being hostage to storage latency — at the cost of the history being eventually consistent.

  • Rate-limited API

    Design a public API with per-key rate limits. Bursty clients, 10,000 requests a second across all keys.

    The limiter shares a Redis instance with the application cache, so a burst of limiter traffic evicts the cache and the origin sees both problems at once.

  • Video upload pipeline

    Design a video upload and transcode pipeline. 500 hours uploaded a minute, several renditions each.

    Transcoding is on the upload path, so a slow worker pool becomes a slow upload. Everything after the object store should be asynchronous, and the queue depth should be what you watch.