What if your favorite app could instantly show new posts without crashing or delays?
Fan-out on write vs fan-out on read in HLD - When to Use Which
Imagine you run a social media app where millions of users post updates. When a user posts, you must send that update to all their followers. Doing this manually means sending messages to each follower one by one every time someone posts.
This manual way is slow and clogs the system because sending updates to thousands or millions of followers at post time takes too long. It also risks errors and delays, making users wait to see new posts.
Fan-out on write and fan-out on read are smart ways to handle this. Fan-out on write sends updates to followers immediately when a post happens, so reading is fast. Fan-out on read keeps posts in one place and sends them to followers only when they check, saving work upfront but making reads slower.
for follower in followers: send_update(post, follower)
Fan-out on write: store post in each follower's feed at write time Fan-out on read: store post once, fetch for followers when they read
These approaches let apps handle millions of users smoothly by balancing speed and resource use for posting and reading updates.
Twitter uses fan-out on write to quickly show tweets to followers, while Instagram uses fan-out on read to save storage and compute when showing posts.
Manual sending to followers is slow and error-prone.
Fan-out on write pushes updates early for fast reads.
Fan-out on read delays pushing updates to save resources.
