advancedTop 30 Scenario-Based Questions
Design a social media feed system (like Twitter) handling 100M users.
Fanout on Write for celebrities vs Pull for normal users: 1) Write path: user posts tweet → stored in tweets:MongoDB. 2) Fanout on Write (< 1K followers): for each follower: LPUSH timeline:{followerId} tweetId. LTRIM to last 1000 tweets. 3) Celebrities (> 1K followers): don't fanout on write (too expensive). On read: merge celebrity tweets with personal timeline. 4) Read path: LRANGE timeline:user
This is a Pro chapter
Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.
Design a social media feed system (like Twitter) handling 100M users.