← All videosTHE SHORT VERSION
More like this ↗

system design / software engineering / interviews / career

System Design Interview: From 1 User to 1 Million. Eight Steps.

A system design walkthrough for when an app goes viral. The picture has no narration. The steps on screen are the scenario, not a measured production system.

At 100 users, the app and database share one server. At 10,000, the CPU is maxed, so the database moves to its own box. At 100,000, a load balancer spreads traffic across three servers. At 250,000, Redis caches the hot reads and answers in under 1 ms. At 500,000, writes hit the primary and reads hit replicas. At 750,000, a CDN serves images and JavaScript from a server near the user. At 900,000, emails and video encodes go through a queue and run in the background. At 1 million, the database is sharded by user id.

The last card is the method: find the bottleneck, remove it, and repeat.

Transcript

0:00Your app just went viral. Here's what breaks.

0:04100 users. One server. Life is good. App and database on one box.

0:0910,000 users. CPU maxed. Move the database out. Now each box does one job.

0:14100,000 users. Add a load balancer. Traffic spreads across 3 servers.

0:19250,000 users. Cache the hot reads. Redis answers in under 1 ms.

0:23500,000 users. Add read replicas. Writes hit the primary. Reads hit the copies.

0:27750,000 users. Serve files from a CDN. Images and JavaScript load from a server near the user.

0:32900,000 users. Queue the slow work. Emails and video encodes run in the background.

0:371 million users. Shard the database. Split users by id across many machines.

0:40That's system design. Find the bottleneck. Remove it. Repeat. Save this for your next interview.

Join the conversation

Loading conversation…