</> MAANG.io

Expert

Design landmark systems in depth, from Dynamo, GFS, Bigtable and Kafka to payments and ads pipelines.

0 of 232 solved 0%

Section 3: The Number That Justifies the Cascade - Scale Estimation & the Latency Budget

Executive Summary: One billion daily users at 50 ad requests each gives 50B requests/day, **580K QPS** on average and ~1.2M QPS at peak. Each request walks a funnel from 50M live ads to ~400K targeting matches, 10,000 candidates, 500 heavy-ranked ads and 3 winners. Scoring 500 per request on accelerators costs 4,000 of them at peak (4,800 provisioned). Scoring all 10,000 would cost 80,000, which is why the ranking cascade exists. The 80 ms p99 deadline splits into eight stage budgets totalling 68 ms plus 12 ms of slack, and Maya's typical request finishes in 38 ms. With ~$260K of revenue flowing every minute, the numbers also explain why the front door must fail open rather than fail.

The interviewer sets the marker down. "Before any boxes. How big is this, and where do the 80 milliseconds go?"

You: "Traffic first, then money, then the funnel. The funnel decides the hardware, and the hardware decides whether the latency budget is even possible."

Traffic: From Users to Requests per Second

You: "I'll take 1B daily actives out of 2B monthly. A feed load, a scroll past a slot, a story, a video break: each asks for ads. Call it ~50 ad requests per DAU per day: four or five sessions, each with a dozen feed loads, scrolls and story breaks."

Requests:      1B DAU × 50/day            = 50B ad requests/day
Average QPS:   50B / 86,400 s             = 578,700  ≈ 580K QPS
Peak QPS:      2× average (evening)       = 1.16M    ≈ 1.2M QPS   <- all capacity math
Ads served:    50B × 3 slots              = 150B ads/day
Impressions:   ~50% actually render       = 75B/day  ≈ 870K/s avg, ~1.7M/s peak
Clicks:        1% CTR on impressions      = 750M/day ≈ 8.7K/s avg, ~17K/s peak

Interviewer: "Why is the peak only twice the average? You're global."

You: "Global softens it but doesn't flatten it. Most users sit in a few clusters of time zones, and their evenings overlap, so the busiest hour carries roughly twice the average hour's traffic. If the real curve is spikier, every capacity number below scales with that one factor."

Interviewer: "Why only half the served ads become impressions?"

You: "Served means we picked it. Impression means it entered the viewport. People scroll away before slot three. That gap matters later: we bill on events, never on what we served."

Quick check before moving on:


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.