How to defend a news feed design in a staff engineer interview

2026-11-28来源 dev.toEnglish

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 enrollments. It expires Dec 28th.

“Maya has 20 million followers and just posted. Are you going to write her post into all 20 million feeds?”

My first question would be how late the post is allowed to be. If a follower opens the app 30 seconds from now, is it OK for them to miss it? How about three minutes from now? I'd make a different call depending on the answer.

Suppose the interviewer gives you 30 seconds to reach 99% of Maya's followers. You've already drawn a worker that copies a post ID into each follower's feed. Keep that drawing for a minute. How far does the worker actually get?

Say the feed store has 100,000 writes per second to spare once ordinary traffic is taken care of. In half a minute you can update 3 million feeds. The other 16.8 million entries due by then are still sitting in the queue. Even if nobody else posts, the last of those entries lands at 3 minutes and 18 seconds.

“I'd keep the worker for most authors. For Maya I'd write the post once, to her own timeline. When one of her followers opens the app, we can fetch Maya's latest posts alongside the feed we've already prepared.”

I'd draw that second lookup on the board. It's easy to say “hybrid fan-out” and leave the impression that we've solved the expensive part. Now give Alice, the reader, 200 high-profile accounts to follow. When she opens the app, how many of those timelines are we willing to wait for?

That's where I'd spend the next few minutes of a staff interview. I'd want to know how common Alice's case is among people who actually open the app. I'd also want to test what she sees when one timeline is slow. If we give up on that lookup after 50 milliseconds, our latency graph might look great while Maya's post keeps disappearing from Alice's feed.

If you're doing a mock this week, give your partner the opening question and keep the 30-second requirement to yourself until they ask. I’m curious what deadline they assumed when they first heard “20 million.”

原文:https://www.a8q9.cn/en/article/how-to-defend-a-news-feed-design-in-a-staff-engineer-interview-ed20cc.html

相关文章