Bird
Raised Fist0
HLDsystem_design~20 mins

Fan-out on write vs fan-out on read in HLD - Practice Questions

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Fan-out Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Fan-out on Write

In a social media system, when a user posts a new update, the system immediately copies this update to all followers' timelines. What is this approach called?

AFan-out on read
BFan-out on write
CLazy loading
DBatch processing
Attempts:
2 left
💡 Hint

Think about when the copying happens: at write time or read time?

🧠 Conceptual
intermediate
2:00remaining
Understanding Fan-out on Read

In a news feed system, when a user opens their feed, the system fetches the latest posts from all the people they follow at that moment. What is this approach called?

AFan-out on write
BData sharding
CPre-computation
DFan-out on read
Attempts:
2 left
💡 Hint

Consider when the system gathers data: during reading or writing?

tradeoff
advanced
2:30remaining
Trade-offs Between Fan-out on Write and Fan-out on Read

Which of the following is a true trade-off when choosing fan-out on write over fan-out on read in a large-scale social network?

AFan-out on write reduces write latency but increases read latency.
BFan-out on write decreases storage costs but increases read latency.
CFan-out on write increases storage costs but reduces read latency.
DFan-out on write reduces both storage and read latency.
Attempts:
2 left
💡 Hint

Think about when data is duplicated and how it affects storage and reading speed.

Architecture
advanced
3:00remaining
Choosing Fan-out Strategy for a High-Traffic Messaging App

You are designing a messaging app where users can have thousands of contacts. Which fan-out strategy is better to handle message delivery efficiently and why?

AFan-out on read, because messages are fetched from the sender's storage when a contact opens the chat, saving storage space.
BFan-out on write, because it reduces storage by not duplicating messages.
CFan-out on write, because messages are copied to all contacts immediately to ensure fast reads.
DFan-out on read, because it duplicates messages to all contacts at read time.
Attempts:
2 left
💡 Hint

Consider the number of contacts and storage implications for immediate copying.

scaling
expert
3:00remaining
Estimating Storage Impact of Fan-out on Write

A social network has 10 million users. Each user has on average 500 followers. If each user posts 2 updates per day, estimate how many total timeline entries are created daily using fan-out on write.

A10 million * 2 * 500 = 10 billion timeline entries
B10 million * 500 = 5 billion timeline entries
C10 million * 2 = 20 million timeline entries
D10 million * 2 / 500 = 40,000 timeline entries
Attempts:
2 left
💡 Hint

Multiply users, posts per user, and followers per user to find total timeline entries.

Practice

(1/5)
1. What is the main advantage of using fan-out on write in system design?
easy
A. Simpler read logic by fetching data on demand
B. Faster read operations by duplicating data during write
C. Reduced storage usage by avoiding data duplication
D. Faster write operations by delaying data duplication

Solution

  1. Step 1: Understand fan-out on write behavior

    Fan-out on write duplicates data to multiple places during the write operation.
  2. Step 2: Analyze impact on read speed

    This duplication allows reads to be faster because data is already pre-distributed and ready to access.
  3. Final Answer:

    Faster read operations by duplicating data during write -> Option B
  4. Quick Check:

    Fan-out on write = Faster reads [OK]
Hint: Fan-out on write means write duplicates data for fast reads [OK]
Common Mistakes:
  • Confusing fan-out on write with fan-out on read
  • Thinking fan-out on write reduces storage
  • Assuming writes are faster with fan-out on write
2. Which of the following best describes fan-out on read?
easy
A. Data is compressed during write to save storage
B. Data is duplicated during write to speed up reads
C. Data is cached permanently to reduce read latency
D. Data is fetched and combined during read to keep writes fast

Solution

  1. Step 1: Define fan-out on read

    Fan-out on read means data is not duplicated during write but fetched from multiple sources during read.
  2. Step 2: Understand write speed impact

    This keeps writes fast because no extra duplication work is done during write time.
  3. Final Answer:

    Data is fetched and combined during read to keep writes fast -> Option D
  4. Quick Check:

    Fan-out on read = Fast writes, complex reads [OK]
Hint: Fan-out on read delays data gathering until read time [OK]
Common Mistakes:
  • Mixing fan-out on read with fan-out on write
  • Assuming fan-out on read duplicates data during write
  • Confusing caching with fan-out on read
3. Consider a system using fan-out on write. If a user updates their profile, what happens during the write operation?
medium
A. The update is duplicated to multiple storage locations immediately
B. The update is written once and read fetches combine data later
C. The update is cached temporarily and written later asynchronously
D. The update is compressed and stored in a single location

Solution

  1. Step 1: Recall fan-out on write behavior

    Fan-out on write duplicates data during the write operation to multiple places.
  2. Step 2: Apply to user profile update

    When a user updates their profile, the system writes the update to all relevant storage locations immediately.
  3. Final Answer:

    The update is duplicated to multiple storage locations immediately -> Option A
  4. Quick Check:

    Fan-out on write = Immediate duplication on write [OK]
Hint: Fan-out on write duplicates data immediately on update [OK]
Common Mistakes:
  • Thinking update is written once and combined later
  • Confusing caching with fan-out on write
  • Assuming asynchronous write in fan-out on write
4. A system using fan-out on read is experiencing slow response times. What is a likely cause?
medium
A. Writes are slow due to data duplication
B. Storage is overloaded due to duplicated data
C. Reads are slow because data is fetched from multiple sources on demand
D. Data is compressed causing decompression delays

Solution

  1. Step 1: Understand fan-out on read read behavior

    Fan-out on read fetches data from multiple sources during read, which can add latency.
  2. Step 2: Analyze slow response cause

    Because reads combine data on demand, slow response times are likely due to this complex read process.
  3. Final Answer:

    Reads are slow because data is fetched from multiple sources on demand -> Option C
  4. Quick Check:

    Fan-out on read = Slow reads if sources are many [OK]
Hint: Fan-out on read can cause slow reads due to multiple fetches [OK]
Common Mistakes:
  • Blaming slow writes in fan-out on read
  • Assuming storage overload in fan-out on read
  • Confusing compression delays with fan-out issues
5. You are designing a social media feed system. Which approach is better if you want instant feed updates but can tolerate higher storage costs?
hard
A. Fan-out on write to duplicate feed data for fast reads
B. Fan-out on read to keep writes fast and storage low
C. Use caching only without fan-out
D. Compress data on write to save storage

Solution

  1. Step 1: Identify system needs

    Instant feed updates require fast reads with up-to-date data.
  2. Step 2: Match approach to needs

    Fan-out on write duplicates feed data during write, enabling fast reads and instant updates but uses more storage.
  3. Step 3: Evaluate other options

    Fan-out on read delays data gathering to read time, causing slower reads. Caching alone may not guarantee instant updates. Compression saves storage but slows access.
  4. Final Answer:

    Fan-out on write to duplicate feed data for fast reads -> Option A
  5. Quick Check:

    Instant updates + higher storage = Fan-out on write [OK]
Hint: Instant reads with more storage? Choose fan-out on write [OK]
Common Mistakes:
  • Choosing fan-out on read for instant updates
  • Ignoring storage cost impact
  • Assuming caching replaces fan-out needs