Lesson 2 of 15
37. Design a News Feed

37.1 What do you ask first?

3 min read+10 XP

Step 1: Requirements (5 minutes)

LetterCandidate asksInterviewer answers
Scope"Text, photos, videos? Likes and comments in the feed? Ranked or time order? Ads?""Text and photos (media stored elsewhere). Show like counts. Ranked, not just time order. Skip ads."
Count"How many users, follows and posts?""200 million daily users. They follow about 200 accounts on average; some accounts have tens of millions of followers. About one post per user a day on average."
Access pattern"How often do people open the feed?""About 10 times a day each."
Latency"How fast must the feed load? How soon should a new post appear?""Under a few hundred ms. A new post should reach followers within seconds to a minute."
Exactness"Must every post appear? In strict order?""Ranked, so not strict order. Missing a post from someone you follow is bad; slight delays are fine."

Agreed requirements:

  • Functional (verbs): users post; users follow others; the app shows a ranked feed of posts from followed accounts, paginated as they scroll; new posts appear within seconds to a minute.
  • Non-functional (adjectives): feed loads fast (under ~300 ms), highly available, scales to celebrities with tens of millions of followers, eventually consistent (a short delay is fine), no repeats or gaps while scrolling.

Interviewer pushback:

  • "Why does the celebrity detail change anything?" → Because the obvious design, copying each new post into every follower's feed, costs one write per follower. For an account with 50 million followers, that's 50 million writes for one post (37.7).

Memory code: "Ask about followers, posts, opens, and who has millions of fans."