</> MAANG.io
system design · 301

Advanced

Master system design interviews with scalable architecture patterns, distributed systems, and real-world design challenges.

0/480 solved 0% complete

Section 3: The Two Numbers That Kill the Easy Designs - Scale Estimation & Workload Analysis

Executive Summary: Writes are small: 100 million posts a day is about 3,500 a second at peak, and pushing each to 200 followers is about 700,000 feed inserts a second. Reads are big: 175,000 feed opens and 350,000 page requests a second at peak, a 100:1 read-heavy system. Two numbers kill the naive designs. Pure pull needs 35 million timeline reads a second, and 87% of opens would wait on at least one slow fetch. Pure push turns one @luna_sings post into 80 million inserts, 80 seconds of the whole fan-out fleet. The hybrid costs 3.5 million cheap key reads a second and 16 TB of RAM, and that RAM, not throughput, sizes the feed cache.

The interviewer slides the marker over. "Before any boxes. How big is this?" You write the agreed inputs in a corner of the board, because every number later in the interview comes from these:

Accounts:    2B registered, 1B monthly actives (MAU), 500M daily actives (DAU)
Graph:       200 followees per active account
Posts:       100M new posts a day
Reads:       10 feed opens per DAU per day
Peak:        3× the daily average, everywhere.  1 day = 86,400 s

The Write Side: Small Until It Multiplies

Start with the graph, because fan-out is graph-shaped:

Follow edges:      1B actives × 200 followees          = 200B edges
                   (active accounts' follow lists; inactive accounts' lists sit cold)
Celebrities:       ~100K accounts above 100K followers, averaging ~200K
                   100K × 200K                           = 20B edges = 10% of all edges
Celebrity follows: 10% of 200 followees                  = 20 per user
Follow changes:    500M/day ÷ 86,400 s                   ≈ 5.8K/s

So Maya, with her 200 followees, follows about 20 celebrities, @luna_sings among them. Now posts:

Posts (avg):    100,000,000 ÷ 86,400 s   = 1,157/s  ≈ 1.2K/s
Posts (peak):   3 × 1,157                = 3,472/s  ≈ 3.5K/s
Fan-out (avg):  1,157 × 200 inserts      ≈ 230K inserts/s
Fan-out (peak): 3,472 × 200 inserts      ≈ 700K inserts/s
Fleet:          sized for 1M inserts/s   (≈ 40% headroom over peak)

The 200 is the average number of active followers of a non-celebrity author. Dev has 350 followers, about 300 of them active, so his hike photo costs about 300 inserts.

Interviewer: "Why 3× for peak? Why not 2× or 10×?"

You: "Feed traffic follows the waking day in each home region, with an evening peak. 3× the 24-hour average is a reasonable planning factor for a consumer app, and I use the same factor everywhere so the numbers compose. I'd swap it for the measured hourly curve on day one. The real spikes, like an awards night, aren't a bigger multiplier on everyone. They're a few huge accounts posting at once, and that's a design problem, not a headroom problem. We'll get to it in a minute."

Interviewer: "And why only active followers?"

You: "Half the registered accounts haven't opened the app in 30 days: 2B registered, 1B monthly actives. Pushing to them would roughly double the work, all into feeds nobody reads. So we keep a 1-bit-per-account activity bitmap and skip anyone inactive. When one of them comes back, we rebuild their feed by pull on the first open. If that slow first open starts hurting retention, we widen the window."


Sign in to continue reading

The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.

Sign in to read the full lesson

Sign in to MAANG.io

Use your Google or Microsoft account — no password to remember.

Continue with Google Continue with Microsoft

Please accept the terms above to continue.