50,000 users hit one endpoint within five seconds. One server answers a single request in 200 ms. The sale still fails. Performance is the latency of one request at low load. Scalability is how throughput and latency behave as load and resources grow.
Start with the offered load. 50,000 arrivals in 5 seconds is 10,000 requests a second. One node serves an assumed 2,000 a second, so 8,000 of 10,000 are refused: 80% errors in the first second.
Then the retries make it worse. In second 2, the 8,000 refused users retry on top of 10,000 new arrivals, so 18,000 requests hit a node that serves 2,000 and 16,000 are refused: 89%. A retry storm is load the system created for itself. Retries are only safe when the request is idempotent, because a load balancer cannot tell whether a timed out request was executed.
Queueing delay is what makes the latency explode before the server is full. In the M/M/1 model the wait is Wq = S times rho over (1 minus rho), where rho is utilisation. The wait is 2.3 service times at 70% busy, 9 times at 90% and 99 times at 99%. That is why teams size near 70%: headroom keeps latency flat, absorbs bursts and lets the fleet lose a node without saturating. Little's law ties it together: L = lambda W, items in flight equal arrival rate times time in system.
Adding servers helps only up to a point. Amdahl's law says speedup is 1 over ((1 minus p) plus p over N), so a job that is 95% parallel caps at 20 times however many cores you add. The Universal Scalability Law adds contention and coherency terms, and past its peak each extra node lowers total throughput, because keeping nodes in agreement costs more than the node adds.
So the worked example sizes at 70%: 1,400 requests a second per node, 10,000 divided by 1,400 is 7.14, so 8 nodes plus 1 spare is 9. Utilisation at peak is 55.6%, and 62.5% with one node lost. The nodes are stateless behind a layer 7 load balancer, sessions live in a shared store, and writes are idempotent so retries are safe.
That moves the bottleneck to the database. At 3 queries per request, 10,000 requests a second is 30,000 queries a second against an assumed limit of 3,000. So admission control is sized from the database, not the app tier: a waiting room admits about 50 users a second, which by Little's law keeps the database near 1,500 queries a second, and anything beyond gets a fast 503 with Retry-After. A token bucket or concurrency limit does the same job at smaller scale.
One last number: tails compound. If 1% of backends are slow and one page fans out to 100 of them, 1 minus 0.99 to the power of 100 is about 63% of requests slow. That is why p99 matters and averages hide the problem.
Read the full article on System Design Simple: https://systemdesignsimple.com/50k-fans-5k-seats/
Top comments (0)