- Massive write amplification: the system performs millions of writes for one post.
- Wasted work: many followers may not open the app for days, so those writes are unnecessary.
Hybrid approach: push for normal users, pull for celebrities
Core idea:- Classify accounts using a follower-count threshold (for example,
100,000followers).- Accounts below the threshold are treated as “normal”. When they post, background workers push their posts into followers’ precomputed lists (fan-out-on-write).
- Accounts above the threshold are flagged as celebrities. Their posts are not pushed to follower lists; instead, they are fetched when followers read their feeds.
- Read Alan’s precomputed feed list from Redis. This contains posts from normal users that were pushed earlier.
- Fetch the most recent posts from the celebrity accounts Alan follows directly from a posts cache or database.
- Merge the two streams (precomputed posts + freshly fetched celebrity posts), sort by timestamp, and return the top N items (for example, 50).
celebrity flag in the users table (derived from follower count) indicates whether a post should be pushed to followers or pulled at read time.

Choosing the follower threshold is a trade-off: set it too low and you’ll increase read-time work; set it too high and you’ll incur expensive write amplification. Monitor system metrics (write throughput, read latency, storage costs) and adjust the threshold based on traffic and cost.
Comparison: fan-out strategies
Key terms and references
- Fan-out-on-read: build the feed when the user reads it (read-time fetch-and-merge).
- Fan-out-on-write: precompute the feed when a post is written (push-to-followers).
- Celebrity flag: a boolean or enum in the user profile that indicates “pull at read time” semantics for that account.
- Redis — https://redis.io/ (common store for precomputed feed lists and post caches)
- System design guides on social feed generation and trade-offs