Lab · Simulation

On call

A day of production traffic in two and a half minutes. It never goes the same way twice: traffic wanders, incidents land at different times, some without warning, and failed requests come back as retries. Keep the system inside its SLO and spend as little as you can doing it.

503 · Service unavailable

This viewport is below minimum capacity.

On call runs a live architecture diagram, a metrics panel, a pager and six scaling controls side by side. A phone can't fit all of it without hiding something you need to watch, so the load balancer is routing you away. Open it on a tablet or desktop.

GET /lab/on-call HTTP/1.1
Viewport: <640px

HTTP/1.1 503 Service Unavailable
X-Min-Viewport: 640px
Retry-After: larger-display

What the simulation models

It is small, but the parts that make real systems fall over are there. Each tier is a pool with a fixed capacity. Latency stays flat until about 80% utilisation and then bends sharply upward, the way queueing delay does. Past 100% a tier builds a backlog, and once the wait passes the one-second client timeout the excess is dropped. Overload doesn't just fail the extra requests: it makes every request slow.

Why it doesn't sit still

Real traffic isn't a smooth curve. Underneath the daily shape (a lunchtime high, an afternoon lull, the evening peak) there is a slow drift that moves the whole day up or down by tens of percent, jitter from second to second, and short bursts nobody announces. The simulation layers all three, so capacity that fits the average still falls over on the bursts. Every shift draws a new day from a seed. A Hacker News spike, a flash sale, a crashed node and a cache flush always happen, but at different times and sizes. Two more incidents come from a wider pool: a crawler, a noisy neighbour on the database host, a rolling deploy, a flaky availability zone, or a mobile release with an eager retry policy.

Clients retry. Most failed requests come back half a second later, and some of the 429s do too. That is what makes a system hard to keep alive: once you fall behind, it is offered more load than its users are sending, so climbing out needs more headroom than falling in did. The traffic metric shows what share of the load is retries.

What helps

The rate limiter is worth a dollar an hour. Shedding the traffic you can't serve keeps the requests you can serve fast, and a 429 is retried far less than a timeout. Rejected requests still count against the SLO, but it is a few percent instead of everything.

  • Cache. Absorbs up to 90% of reads once warm. A cold cache is the same as no cache, which the evening deploy will remind you of.
  • Read replicas. Split read load with the primary. They take longest to provision because they copy data first.
  • Queue and workers. Writes behind a queue are acknowledged at once and drained by workers. The workers back off when the primary has no headroom, so a burst becomes a backlog instead of an outage.

The p99 shown is derived rather than sampled. Each path a request can take (cache hit, primary read, replica read, sync write, queued write) has a mean latency and a backlog wait. Its tail is treated as exponential, and p99 is the latency that 1% of all requests exceed. The error budget is 1% of the day's projected user traffic. Retries count against it too, which is part of why they hurt.