Paths Subjects Questions Quizzes Pricing Search
Intermediate Open Free

Capacity Estimation From Scratch

You are asked to design a news feed for a new social app with the following assumptions: 50 million daily active users, each opening the feed 8 times a day; 5% of DAU post once per day; the average user has 150 followers; assume a peak-to-average traffic ratio of 3×.

  1. Compute average and peak feed-read QPS.
  2. Compute average post-write QPS and the average number of fan-out writes per day if every post is pushed to every follower's feed.
  3. Based on these numbers, is pure fan-out-on-write viable for all users in this system? Justify with the arithmetic, not just intuition.
Solution

1. Feed reads: Reads/day = 50M × 8 = 400M. Average QPS = 400,000,000 / 86,400 ≈ 4,630. Peak QPS ≈ 4,630 × 3 ≈ 13,900 QPS.

2. Post writes and fan-out: Posts/day = 50M × 0.05 = 2.5M. Average write QPS = 2,500,000 / 86,400 ≈ 29 QPS (peak ≈ 87 QPS) — negligible next to reads.

Fan-out writes/day = 2.5M posts × 150 followers = 375M writes/day. Average fan-out QPS = 375,000,000 / 86,400 ≈ 4,340/s, peak ≈ 13,000/s — over 100× the raw post-write rate, and comparable in magnitude to the feed-read QPS. This is the number that should drive the design conversation, not the 29 QPS of posts.

3. Is pure push viable for everyone: For the average user (150 followers) pure push is cheap: one post becomes 150 cache writes, done in milliseconds. But the average hides the tail: a user with 5 million followers turns a single post into 5 million writes. At a sustained fan-out throughput of, say, 50,000 writes/s per worker fleet, that one post takes 100 seconds to fully propagate, during which it competes with every other user's fan-out and delays their posts too. So pure push is viable for the bulk of ordinary accounts but not for high-follower accounts — the standard fix is a hybrid: push for accounts under a follower threshold, and merge in a pull query for the few celebrities a user follows, so no single post can generate a multi-minute write storm.

Share this question

← Back to Design a News Feed (Twitter / Facebook-style Timeline) practice

We use cookies for product analytics to improve OmniAtlas. See our Privacy Policy.