Estimating QPS from daily users in three steps
Turn "10 million daily users" into requests per second, peak load and a machine count, with the arithmetic shown.
Most capacity questions start with a user count and end with a number of machines. The steps in between are short once you have done them a few times.
Step 1: requests per day#
Say the hypothetical app has 10 million daily users, and each one opens the feed 20 times a day. That's 10,000,000 × 20 = 200 million feed requests a day.
Step 2: average and peak per second#
A day has 86,400 seconds, so the average is 200,000,000 / 86,400 ≈ 2,300 requests a second. Traffic isn't flat; assume the busiest hour runs at three times the average, which gives about 7,000 a second.
Step 3: machines#
If one API server handles 1,000 feed requests a second, the peak needs 7 servers. Add one so a deploy or a failure doesn't push the rest past their limit: 8 servers.
The back-of-the-envelope math lesson works through the same method with storage and bandwidth.
Filed under estimation, interviews
Written by Anubhav Sethi