Write Amplification: Where Fan-out Breaks

The bug this introduces: the celebrity problem (a.k.a. the "hot user" or "thundering herd of writes"). One tweet from a mega-account triggers tens of millions of writes, all at once, and the pure push model collapses under it.

What "write amplification" means, precisely

Write amplification = the number of physical writes the system performs per logical write the user performs. The user does one thing (post a tweet). The system does N things (insert into N follower timelines). The amplification factor is N = your follower count.

1 logical write (tweet)  ──fan-out──►  N physical writes (one per follower)

   amplification factor = N = number of followers

For a normal user, N is small and nobody notices. The whole design lives or dies on the distribution of N across users — and that distribution has a monstrous tail.

The math: where does it break?

Let's put numbers on it. Say each timeline insert (a Redis ZADD plus bookkeeping) is cheap — call it tens of microseconds of work, but it must be done N times, often spread across many Redis shards, and ideally quickly so the tweet appears promptly.

Follower count (N) Physical writes per tweet Verdict
200 (typical) 200 Trivial. Done in milliseconds.
20,000 20,000 Heavy but tolerable — completes in a bounded time.
1,000,000 1,000,000 A single tweet now hammers a million timeline entries. Seconds of fan-out work, large burst.
100,000,000 (mega-celebrity) 100,000,000 Catastrophe. One tweet = 100M writes.

Consider the worst case concretely. An account with 100 million followers tweets. Pure push demands 100 million timeline inserts for that one tweet. And these aren't spread out — they're triggered by a single instant. The fan-out service must:

  • read a follower list of 100M entries,
  • spray 100M writes across the entire Redis timeline cluster,
  • finish fast enough that the tweet isn't embarrassingly late.

Why this is so much worse than it looks

It's not just the raw count. Three multipliers turn a big number into an outage:

  1. Burstiness / thundering herd. A celebrity tweet is a single event. The 100M writes arrive as a spike, not a smooth stream. Spikes blow past provisioned capacity even if average throughput is fine.
  2. Correlated celebrity activity. Big accounts often tweet around big events (finale, match, breaking news) — simultaneously. Multiple 50M-follower fan-outs overlapping = hundreds of millions of writes in seconds.
  3. Fan-out latency couples to follower count. The more followers, the longer the fan-out takes to complete, so the celebrity's tweet takes longer to become visible to everyone — the exact opposite of what you want for your most-watched accounts (more on this consistency angle in the eventual consistency part).
Normal user tweets:        Celebrity (100M) tweets:

    ●                            ●
   ╱│╲                    ╱╱╱╱╱╱╱│╲╲╲╲╲╲╲
  ╱ │ ╲                  ╱╱╱ thousands of ╲╲╲
 200 writes             ╱╱  shards saturated ╲╲
 (a blip)              100,000,000 writes in a burst
                       (the cluster catches fire)

The asymmetry that names the fix

Look back at the fan-out on read part’s table. For a celebrity:

  • Push (write side) is catastrophic: N writes, N = 100M.
  • Pull (read side) is trivial: the celebrity authored one tweet, stored in one place. Fetching it at read time is a single lookup.

So the two models have opposite failure profiles:

Normal user Celebrity
Push (fan-out on write) ✅ cheap (small N) ❌ catastrophic (huge N)
Pull (fan-out on read) ❌ expensive (read fans out to hundreds) ✅ trivial (one author, one tweet)

This table is the whole answer. Neither model is universally right. Push wins for the masses; pull wins for celebrities. The optimal system uses each model exactly where it's cheap — and that's the hybrid (see hybrid model).

Why you can't just "throw hardware at it"

A tempting staff-interview wrong answer: "scale out the fan-out service." It doesn't save you, because:

  • The cost is fundamental and linear in follower count — more machines lower latency but the total work per celebrity tweet is still 100M writes. You're paying 100M writes' worth of cluster capacity to deliver one tweet, most of it to followers who won't look soon.
  • It wastes storage and write bandwidth duplicating one tweet ID into 100M lists.
  • It makes the burst problem worse, not better — you've built capacity that sits idle until a celebrity tweets, then saturates.

The right move isn't more hardware; it's to not fan out at all for these accounts. Recognize the few thousand accounts whose N is enormous, and handle their tweets by pull. Everyone else stays on push.