Skip to main content

Scaling Feeds: Redis, Fan-Out, and the Lady Gaga Problem

Updated 5 min readMarkdown
Scaling Feeds: Redis, Fan-Out, and the Lady Gaga Problem

Quick Answer: In 2012, Twitter precomputed user feeds in Redis lists to sustain 300,000 timeline reads per second via fan-out on write. However, high-profile accounts like Lady Gaga triggered millions of concurrent writes per tweet. Twitter resolved this "celebrity problem" by implementing a hybrid architecture: standard accounts push to follower lists, while high-follower accounts are merged dynamically at read time.

Whenever I chat with engineers about distributed systems, feed architecture is one of my favorite topics to explore. On paper, delivering a chronological stream of updates seems trivial. In practice, wildly lopsided read-to-write ratios will quickly overwhelm traditional architectures.

Back in 2012, Twitter ran directly into this scaling barrier. Their users read timelines far more often than they tweeted, pushing platform read traffic to 300,000 requests per second. Calculating feeds dynamically at runtime using relational queries simply wasn't viable. To keep reads fast, Twitter precomputed feeds ahead of time—until Lady Gaga broke the model.

Why did Twitter use Redis lists for user timelines?

Twitter used Redis lists to eliminate expensive database joins on read operations by precomputing each user's home timeline ahead of time. By pushing new tweets directly into in-memory lists, reading a timeline became a trivial key-value fetch capable of handling hundreds of thousands of requests per second.

The way I look at this pattern is through the lens of fan-out on write (the push model). Instead of waiting for you to open the app and querying every account you follow, background workers do the heavy lifting when an author posts:

  1. A user posts a tweet.
  2. The system fetches the author's follower list.
  3. The tweet ID is pushed to every follower's individual Redis list.
  4. When a follower opens their feed, Twitter simply fetches that precomputed list.

If an author has 20 followers, publishing a tweet triggers only 20 lightweight Redis writes. For standard accounts, I consider this an ideal tradeoff: reads stay blazing-fast, and write amplification remains imperceptible.

What is the "Lady Gaga problem" in fan-out architectures?

The Lady Gaga problem occurs when an account with tens of millions of followers writes an update, forcing a push architecture to execute millions of writes simultaneously for a single event. In a pure fan-out-on-write model, this causes massive write amplification, queue backpressure, and cache thrashing.

I find this scale mismatch fascinating. In 2012, Lady Gaga had roughly 31 million followers. Under a pure push architecture, one tweet from her required 31 million distinct writes to 31 million separate Redis lists.

Imagine your background worker queues suddenly receiving an avalanche of 31 million write tasks every time a pop star posts an update. While standard accounts barely registered on background workers, celebrity accounts saturated queues and delayed feed delivery across the entire platform. Pushing millions of writes for every single high-profile post simply could not scale.

Architecture Strategy Read Latency Write Latency Celebrity Scalability
Fan-out on Read (Pull) High (aggregates all follows on load) Low (single write to user's outbox) High (celebrities post with no write penalty)
Fan-out on Write (Push) Extremely Low (O(1) cache fetch) High (amplified by follower count) Poor (triggers millions of worker writes)
Hybrid (Twitter's Fix) Low (cache fetch + light merge) Low-Medium (standard users push, VIPs bypass) Excellent (isolates celebrity writes)

How does a hybrid push-pull feed architecture work?

A hybrid feed architecture categorizes users based on follower count, applying fan-out on write for standard users and fan-out on read for accounts exceeding a specific threshold. At read time, the client fetches the precomputed timeline and merges it with the recent posts of any followed VIP accounts.

To me, Twitter's hybrid solution represents one of the cleanest engineering compromises in system design. Instead of forcing every user into a single processing path, they introduced a follower threshold:

  • Standard Accounts (< Threshold): Continue using fan-out on write. When a typical user tweets, workers append the tweet ID to all follower Redis lists immediately.
  • Celebrity Accounts (> Threshold): Completely bypass fan-out on write. Lady Gaga's tweet is written only to her own user outbox.

When you open your feed, the system grabs your precomputed Redis timeline, makes a lightweight query to retrieve recent posts from the few celebrities you follow, and blends the streams together in memory before returning the payload. I love this approach because it protects high-speed cache reads for 99% of user activity without melting down Redis every time a mega-account posts.

Frequently Asked Questions

What is write amplification in social media system design?

Write amplification refers to the ratio of downstream system writes generated by a single user write. In a push-based feed architecture, posting one message can trigger millions of secondary database writes depending on the author's follower count.

Why not use a pure fan-out-on-read model for everyone?

A pure fan-out-on-read model requires querying the posts of every single user you follow whenever you load your timeline. In read-heavy systems where reads outnumber writes by 100:1 or more, this generates excessive query volume and introduces high p99 read latency.

How does the hybrid model handle timeline pagination?

Precomputed timelines maintain a fixed window of recent tweet IDs (e.g., the last 800 items). During pagination, the system scans backward through both the precomputed Redis list and the indexed celebrity outboxes, merging and sorting by timestamp as the user scrolls.

The hybrid push-pull split is the cleanest part of this. Precomputing timelines in Redis lists is a classic read optimization, but the celebrity cutoff is what makes it survivable in practice — one account with 30M followers should never be allowed to enqueue 30M writes. The 800-item window detail is a good reminder too: a precomputed feed is a cache with a TTL, not a full history.