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?
Think about when the copying happens: at write time or read time?
Fan-out on write means the system distributes data to all relevant places immediately when data is written, such as copying a post to followers' timelines right away.
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?
Consider when the system gathers data: during reading or writing?
Fan-out on read means the system gathers or computes data only when a user requests it, such as fetching posts from all followed users when the feed is opened.
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?
Think about when data is duplicated and how it affects storage and reading speed.
Fan-out on write duplicates data to many places at write time, increasing storage but making reads faster since data is pre-assembled.
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?
Consider the number of contacts and storage implications for immediate copying.
Fan-out on read is better here because copying messages to thousands of contacts immediately would be expensive in storage and write load. Fetching on read saves resources.
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.
Multiply users, posts per user, and followers per user to find total timeline entries.
Each post is copied to all followers' timelines. So total entries = users * posts per user * followers per user.
