Skip to the content.

1. What is a Fanout Service?

A fanout service is a service that receives a single request and then distributes (fans out) that request to multiple downstream services.

Think of it like a teacher giving a task to students: the teacher (fanout service) tells many students (downstream services) to do their part.

Example in software:


2. Fanout Models: Pull vs Push

There are two main ways a fanout service can distribute requests: Push model and Pull model.


A. Push Model

In a push model:

Analogy:

Pros:

Cons:

Example in tech:


B. Pull Model

In a pull model:

Analogy:

Pros:

Cons:

Example in tech:


3. Quick Comparison Table

Feature Push Model Pull Model
Who initiates? Fanout service Downstream service
Speed Fast Dependent on poll frequency
Reliability Needs retry logic More reliable if queue used
Load control Hard (can overwhelm) Easy (consumer controls)
Use case Real-time updates Asynchronous processing

4. When to Use Which


🔹 Fanout in News Feed Systems

“Fanout” = distributing posts from one user to many followers. When User A posts, that post needs to be delivered to all followers’ feeds.

There are two approaches: Push-based fanout and Pull-based fanout.


1️⃣ Push-based Fanout

👉 As soon as a user creates a post, push it to all their followers’ feed timelines.

Flow:

  1. User A creates a post.
  2. System writes that post into every follower’s feed storage (denormalization).
  3. When followers open their feed → posts are already there.

✅ Advantages

❌ Disadvantages


2️⃣ Pull-based Fanout

👉 Store posts only in the author’s “outbox” and fetch them on-demand when a follower opens their feed.

Flow:

  1. User A creates a post.
  2. Post stored in User A’s timeline storage (outbox).
  3. When User B (follower) opens their feed → system fetches posts from all people they follow, merges, sorts, and shows.

✅ Advantages

❌ Disadvantages


3️⃣ Hybrid (Real Systems Use This)

Most large systems (Facebook, Twitter, LinkedIn) use a hybrid of push + pull:

👉 This balances read performance and write scalability.


🔹 Example in News Feed

Imagine Virat Kohli posts:

But if you post to your 200 friends, it’s fine to push it directly into their feeds.


✅ In short: