Knowledge Guide
HomeSystem DesignCapacity Estimation

hard Drill: Twitter timeline sizing

Drill

300M DAU, 2 tweets/user/day (~300 B each), each user follows ~200 people and reads their timeline ~10×/day. Estimate write QPS, read QPS, yearly tweet storage, and name the key bottleneck.

✅ Worked solution & bounds check

Worked solution

  • Writes: 300M × 2 = 6×10⁸/day ÷ 10⁵ = ~6,000 writes/s (peak ×5 ≈ 30K/s).
  • Timeline reads: 300M × 10 = 3×10⁹/day ÷ 10⁵ = ~30,000 reads/s (peak ≈ 150K/s).
  • Tweet storage: 6×10⁸ × 300 B × 365 ≈ ~65 TB/yr (×3 ≈ 200 TB).

Bottleneck / gate: read-heavy + fan-out. Naive read-time fan-out (query 200 followees per timeline load) is far too expensive ⇒ fan-out-on-write (precompute timelines into a cache), with a hybrid for celebrity accounts (millions of followers ⇒ fan-out-on-read for them to avoid write storms).

🤖 Don't fully get this? Learn it with Claude

Stuck on Drill: Twitter timeline sizing? Open Claude, copy a block below, and it'll teach you this exact concept — visually and interactively.

🪜 Hint ladder (no spoilers)

Progressively stronger hints — you still solve it.

I'm working on the problem **Drill: Twitter timeline sizing** (System Design). Give me a HINT LADDER: start with the tiniest nudge, then wait. Only reveal the next, stronger hint when I ask. Do NOT show the full solution unless I type 'show solution'. Keep me doing the thinking. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🎨 Explain the approach visually

See the technique, not just code.

Explain the optimal approach to **Drill: Twitter timeline sizing** with a VISUAL walkthrough: trace it on a small concrete example using ASCII art / a step-by-step diagram, narrate what changes each step, then give time & space complexity with a one-line derivation. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🔍 Review my solution

Catch bugs, edge cases, sub-optimality.

I'll paste my solution to **Drill: Twitter timeline sizing**. Review it for correctness, missed edge cases, and time/space complexity, then coach me toward the optimal — don't just rewrite it. Ask me to paste my code now. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🔁 Drill the pattern

Lock in recognition with look-alikes.

Give me 2 problems that use the SAME underlying pattern as **Drill: Twitter timeline sizing**. For each, let me attempt first, then review my answer and name the trigger signal that reveals the pattern. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.

📝 My notes