Selective Fanout Optimization
You'll learn how to reduce fanout overhead by intelligently filtering which followers actually receive a post during fanout-on-write.
The Core Problem
When a user publishes a post, your fanout service doesn't need to deliver it to every follower blindly. Many followers shouldn't receive certain posts due to:
- Privacy settings (post is "friends only" but some followers aren't friends)
- Muted relationships (follower muted this user)
- Blocked relationships (either party blocked the other)
- Inactive accounts (user hasn't logged in for months)
Pushing posts to feeds that will never be read wastes compute, storage, and money at scale.
How Selective Fanout Works
During the fanout worker's processing loop, before writing a post to each follower's feed cache, apply filters:
For each follower in follow_graph:
IF follower is blocked by author: SKIP
IF author is muted by follower: SKIP
IF post visibility = "friends" AND follower not in friends: SKIP
IF follower inactive > 90 days: SKIP
ELSE: write post to follower's feed
This requires the fanout service to access:
- Block/mute graph (separate storage or cached lookup)
- Privacy metadata from the post
- Friend relationships (if distinct from followers)
- User activity timestamps
Optimization Benefits
With 10 million followers but 2 million blocks/mutes, you save 2 million unnecessary feed writes per post. At billions of posts per day, this dramatically reduces infrastructure costs and speeds up fanout completion.
Key Takeaway:
Selective fanout filters out ineligible recipients during fanout-on-write, reducing wasted storage and compute by respecting privacy, blocks, mutes, and activity patterns before writing to follower feeds.