You open the app and your feed is there in an instant, assembled from posts by everyone you follow, freshly ranked. Building that feed for one person is easy. Building it for hundreds of millions of people, where some accounts are followed by tens of millions and everyone expects an instant load, is one of the classic hard problems in system design. The whole thing comes down to one decision: when do you do the work of assembling a feed, at write time or at read time.
The core problem
A feed is the merged, ranked list of recent posts from the accounts a user follows. There are two obvious moments to build it. You can build it when someone posts (push the new post into all their followers' feeds), or you can build it when someone opens the app (pull recent posts from everyone they follow and merge). These are fanout on write and fanout on read, and each is great in one situation and terrible in the other.
Key design decisions
Fanout on write: precompute every follower's feed. When a user posts, you immediately insert that post into a precomputed feed list for each of their followers, often held in a fast store like Redis. Reads are then trivial: a user's feed is already sitting there, ready to return. This makes the read path blazing fast, which matters because reads vastly outnumber writes. The cost lands on writes and storage. Every post does work proportional to the follower count, and you store a copy of post references in many feeds.










