News feed
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 11 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    How many feed-list inserts a second does pushing cost?

      How many feed pages, and rankings, a second at peak?

        How much memory do the feed lists need?

          What does pushing one 100M-follower post cost?

            Build-up · 5 steps

            Build the high-level design

            One functional requirement at a time, ending with a feed that works for a modest user base before any scaling.

            Step 1 of 5

            Create a post

            Photos go straight to blob storage. The post service stores one row and publishes post.created. It touches nobody’s feed, so posting stays fast however many followers the author has.

            6 interview moments

            You’re the candidate

            The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

            1. Deep dive 1 of 6

              Interviewer

              “A billion posts a day, and readers following about 300 accounts each. How does a new post reach its followers’ feeds?”

              Your move. Pick an approach:

            2. Deep dive 2 of 6

              Interviewer

              “A film star with 100M followers posts 20 times during an IPL final. How do you keep everyone else’s feed fresh?”

              Your move. Pick an approach:

            3. Deep dive 3 of 6

              Interviewer

              “Every active reader needs their newest few hundred post IDs in about a millisecond, at 7M appends a second. Where do feeds live?”

              Your move. Pick an approach:

            4. Deep dive 4 of 6

              Interviewer

              “About 1,000 candidate posts, 20 slots, and 250 ms for the whole first page. How do you rank them?”

              Your move. Pick an approach:

            5. Deep dive 5 of 6

              Interviewer

              “Asha is scrolling when three friends post. How do you serve her next page with no repeats and no gaps?”

              Your move. Pick an approach:

            6. Deep dive 6 of 6

              Interviewer

              “An author narrows a post from public to friends after it reached 200 feeds. How do you make sure nobody else sees it?”

              Your move. Pick an approach:

            Build-up · 9 steps

            Follow one post, then one feed open

            Writes are cheap and asynchronous. Reads start from one list, pull a few hot outboxes, rank once per session and hydrate from a graph-aware cache.

            Step 1 of 9

            Post

            The client calls POST /v1/posts with text and media IDs; any photo is already in blob storage. The post service assigns a time-sortable ID.