Back-of-the-envelope estimation for system design interviews: size a 200M-user photo app in five minutes
The interview question: "Design a photo-sharing app for 200 million daily users." Before you draw a single box, the interviewer expects you to put numbers on it. Back-of-the-envelope estimation is not about being right to three decimal places. It is about getting the order of magnitude right, fast and out loud, so you know which problems are real: one database or a hundred, one network link or a…
Designing a photo-sharing app for 200 million daily users is a common interview question. To estimate the system requirements, follow a back-of-the-envelope approach. First, understand why rough numbers matter - they decide the design. Assume each user makes 20 requests per day, 5% of which are uploads of 500 KB, and they keep photos for 5 years. This results in 4 billion requests per day, averaging 46,000 requests per second, with a peak of 139,000 requests per second.
Next, consider what is fast and what is slow. Operations like L1 cache reference take 1 ns, while reading from main memory takes 100 ns, SSD random read takes 100 µs, and a hard disk seek takes 10 ms. Network latency is also crucial; a round trip between California and Netherlands takes 150 ms. Memory is faster than disk, hence caches are used. Distance across oceans cannot be optimized away; use CDNs to move data closer.
Five key facts cover most interview scenarios: a day has about 10^5 seconds (86,400), 1 million requests per day translates to 12 requests per second, and 1 billion daily requests is about 12,000 requests per second. Size units step by 1,000 (KB, MB, GB, TB, PB), and Little's law states that requests in flight equal arrival rate multiplied by time each request takes.
To size the photo app, calculate requests per day (4 billion), average requests per second (46,000), and peak requests per second (139,000). New data per day is 100 TB, which over 5 years with 3 replicas results in 548 PB. Store photos in an object store, not a database, as the metadata lives in a small database.
Finally, consider additional factors. Add a 30% buffer for headroom, aiming for around 40 servers at 70% utilization. Bandwidth is critical; with 95% reads serving 200 KB each, peak egress is around 26 GB/s, or 210 Gbps. Uploads add an additional 3.5 GB/s of ingress. Use Little's law to estimate concurrent requests, which in this case is about 14,000. Practicing with the Designbench estimator helps you quickly calculate these numbers for different scenarios.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.