Course contentsShow
← System Design
Lesson 1647 of 1,91940. Real-World System: Social Media FeedFree lesson

Fanout-on-Read (Pull Model)

Aggregating posts from followed users at read time, trading write efficiency for potential read latency.

Fanout-on-Read (Pull Model)

What you'll learn: How social media feeds can aggregate posts on-demand when users request them, prioritizing write speed over read speed.

The Core Idea

In Fanout-on-Read (also called the Pull Model), when a user creates a post, you simply store it once in a central location (like a posts table). Nothing else happens immediately. Later, when someone wants to see their feed, you pull posts from all the users they follow at read time, aggregate them, sort by timestamp, and display them.

Think of it like calling each of your friends individually when you want to catch up, rather than having them all send you updates automatically.

How It Works

  1. Write time: User A posts → store post in database with user_id and timestamp
  2. Read time: User B opens feed → query: "Get recent posts from all users B follows" → sort and display

Your system queries the follow graph, fetches posts from each followed user, merges them, and returns the result.

Trade-offs

Advantages:

  • Fast writes – just one database insert per post
  • No fanout computation – no need to write to millions of feed timelines
  • Always fresh – every feed read gets the latest posts
  • Efficient for celebrities – avoids pushing to millions of followers

Disadvantages:

  • Slow reads – if you follow 1,000 people, you're querying 1,000 users' posts
  • Database strain – every feed refresh triggers complex joins and aggregations
  • Poor user experience – feeds may take seconds to load during high traffic

When to Use

Best for users who follow many accounts (especially celebrities) or when you need guaranteed freshness and simpler write paths.

Key Takeaway: Fanout-on-Read sacrifices read speed for write efficiency, making it ideal for scenarios where users follow many accounts but checking feeds is less frequent than posting.