#40 · Virat posts, 25 crore feeds update

How does one celebrity post reach crores of feeds in seconds? Fan-out on write vs fan-out on read, and the hybrid answer interviewers want.

2 min readReels · Reel Notes

Ek line yaad rakho: chhote ko push karo, bade ko pull.

This is the classic interview answer for news feeds (Twitter, Instagram-style), not Instagram's exact internal system. Virat Kohli has more than 25 crore (250M) Instagram followers.

Two ways to build a feed

Fan-out on write (push)Fan-out on read (pull)
When work happensWhen someone postsWhen you open the app
What it doesCopies the post ID into every follower's feedFetches recent posts from people you follow, then merges
Opening the appVery fast: the feed is readySlower: merge at read time
Posting1 post × N followers writes1 write
Breaks whenA celebrity posts (25 crore writes)You follow thousands of accounts

The hybrid

  1. Normal users (say, under ~10k followers): push. Each post is written into every follower's precomputed feed.
  2. Celebrities: don't push. Their posts stay in one place.
  3. When you open the app: read your precomputed feed, pull the latest posts from the celebrities you follow, merge, rank, show.

Interview words

TermMeaning
Fan-out on writePush copies to followers at post time
Fan-out on readPull and merge at read time
Hybrid fan-outPush for normal users, pull for celebrities
Celebrity / hot-key problemOne account with huge reach overloads a push design
Feed cachePrecomputed list of post IDs per user (often Redis)

Follow-up questions

Where is the cut-off between push and pull? A follower threshold (e.g. 10k or 100k). Pick it from data: the write cost of push vs the read cost of merging.

Do you copy the whole post into every feed? No. Only the post ID (and maybe a timestamp). The post itself lives once in the posts store and is fetched when shown.

What about inactive users? Don't push to people who haven't opened the app in weeks. Build their feed when they come back. This saves most of the writes.

How is the feed ordered? Ranking (likes, relationship, recency) happens after the merge, not during fan-out.

Go deeper

Part of the Designs track (Worked designs, high level and code level).

Finished reading?

Mark it done to track your progress in Reels.