How to defend a news feed design in a staff engineer interview
If you’d rather watch someone draw a system than read another design doc, that’s how I teach my staff system design interview course on Udemy . In the news feed lesson, we follow one post from the author to a follower’s screen. When the interviewer changes the numbers, you can see which arrow on the diagram has to change. That link includes my instructor coupon, free for the first 100…
This article explains how to approach a news feed design question during a staff engineer interview. The example provided is based on an interview scenario where Maya, a popular author, posts a new update. The interviewer asks how long it will take for Maya's followers to see the post. The answer depends on how late the post is allowed to be.
To answer this question, start by drawing a diagram of the system that copies a post ID into each follower's feed. Next, consider how far the worker can actually get within the given time frame. If the feed store can handle 100,000 writes per second, the worker can update 3 million feeds in just half a minute. The remaining 16.8 million entries will still sit in the queue.
The interviewer then presents an alternative solution for popular authors like Maya. Instead of copying the post into all followers' feeds, write the post once to Maya's own timeline and fetch it alongside the feed when a follower opens the app. This approach is known as "hybrid fan-out."
To further test the interviewee's understanding, ask how many high-profile accounts Alice, the reader, is willing to wait for when opening the app. This question helps determine the commonality of Maya's case among actual app users. Additionally, consider what happens if one timeline is slow and the lookup takes longer than expected. Ensure that the latency graph still looks good, even if some posts disappear from Alice's feed.
During the mock interview, give your partner the opening question and refrain from mentioning the 30-second requirement until they ask. This will give them a chance to come up with their own assumptions about the deadline when first hearing about the 20 million followers.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to