Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

System Design (High-Level Design) Module 23

Case studies: social, feeds and search interview questions

Interview questions on “Case studies: social, feeds and search”: warm-ups, then what each harder question tests and how a good answer starts.

33 questions: 7 warm-ups and 26 with model answers · Levels: Fresher to staff

Warm-up questions

Short questions with short answers, each answered in full.

  1. Fresher to mid

    What is the difference between fan-out on write and fan-out on read?

    Answered in the lesson Design a news feed

  2. Fresher to mid

    Why does a feed API page with a cursor instead of page numbers?

    Answered in the lesson Design a news feed

  3. Fresher to mid

    What does robots.txt control, and what does it not?

    Answered in the lesson Design a web crawler

  4. Fresher to mid

    Why is a new post not searchable the instant it is written, and what sets the delay?

    Answered in the lesson Design X (Twitter): timelines and search

  5. Fresher to mid

    What does PageRank measure, and why is it computed offline rather than for each query?

    PageRank measures how likely a random surfer is to be on a page: someone who follows links and now and then jumps to a random page. A page ranks high when many pages link to it, and higher when those pages rank high themselves; Brin and Page set the damping factor, the share of steps that follow a link, at 0.85. The score depends only on the link graph, not on the query, so it is computed once over the whole graph by repeated rounds of passing rank along links, which takes hours at the scale of the web, and stored with every page. At query time the engine only reads it and combines it with a text score such as BM25.

    From the lesson Design a simplified web search engine

  6. Fresher to mid

    What does a 304 Not Modified answer save a feed poller, and what must the poller send to get one?

    It saves downloading and parsing a feed that has not changed. When the poller sends the ETag of its last 200 answer in an If-None-Match header, or its Last-Modified value in If-Modified-Since, a server whose feed is unchanged answers 304 with no content: a few hundred bytes instead of tens of kilobytes. The poller keeps the entries it already has and polls again later. When both headers are sent, the server uses the ETag and ignores the date. This works only if the poller stores the validators of every 200 answer; one that never sends them downloads the whole feed every time.

    From the lesson Design a news aggregator

Questions with model answers

What each question tests, the first step of a good answer and the follow-ups to expect.

  1. Mid to senior

    A user deletes a post, yet some followers keep seeing it in their feeds for several minutes. List the likely causes, and redesign the feed so that deletes and audience changes take effect on the next read.

    What it tests
    Finding every copy of a post (inboxes, caches, session lists, CDN and app storage), enforcing visibility at read time, and invalidation that does not depend on one step succeeding.
    First step
    List every place a copy can live: the inbox ids, the post cache, a ranked session list, a CDN or browser copy of the feed response, and the app's offline store. Then ask which of them the read path checks against the post record, because any copy served without that check outlives the delete.
    Follow-ups

    From the lesson Design a news feed

    Model answer, Pro. Model answers open with any pass; prices are in the notice on this page.

    Opening the model answers with your pass…

    Model answers open with any MySmartCoPilot pass.

    • Pro pass · 1 week₹79$2.99
    • 30 days₹179$5.99
    • 1 year₹1,699$45

    One payment; a pass never renews. The price shown is the total you pay: no fees or charges are added at checkout.

    It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  2. Senior to staff

    Your feed moves from newest-first to a ranked order, and readers now report duplicates and missing posts while they scroll. Explain why, and design pagination for a ranked feed.

    What it tests
    Why score-ordered pages are unstable, feed sessions with stored ranked lists, cursors over them, and new posts and visibility changes during a scroll.
    First step
    Show the failure with two pages: page 1 is cut at a score, engagement then changes the scores, and posts move across the cut in both directions. Then hold the order still for one scroll: rank once, store the ranked ids under a session, and page by offset within that stored list.
    Follow-ups

    From the lesson Design a news feed

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  3. Mid to senior

    A large news site's robots.txt has answered 503 for a day, while its pages load normally. What does your crawler do today, after a week and after a month, and why?

    What it tests
    How RFC 9309 treats an unreachable robots.txt, using a cached copy, backing off politely, and keeping the host's URLs without letting them fill the frontier.
    First step
    Look up what the robots.txt standard says about a file that cannot be fetched, and why a server error is treated differently from a missing file. Then check whether a cached copy of the file exists, and decide what the crawler does with the site's queued URLs meanwhile.
    Follow-ups

    From the lesson Design a web crawler

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  4. Mid to senior

    Half the URLs in your frontier belong to one site of 50 million pages, which allows one request every 2 seconds. Design the frontier so that the crawler stays busy and the big site is still covered sensibly.

    What it tests
    Per-host politeness arithmetic, a frontier with priority queues and one queue per host, keeping one host from filling memory, and ranking pages inside a host.
    First step
    Compute the host's ceiling: one request every 2 seconds is 43,200 pages a day, so 50 million pages take more than three years whatever you do. Then separate the goals: keep the fetchers busy with other hosts, and spend the big host's budget on its best pages.
    Follow-ups

    From the lesson Design a web crawler

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  5. Senior to staff

    A crawl of a shopping site produces millions of URLs that differ only in sort, filter and session parameters, and most of them show the same products. How do you detect this and stop it without missing real pages?

    What it tests
    Recognising a crawler trap, learning which parameters change content, caps per path template, and judging a crawl by the new content it finds.
    First step
    Count the combinations to show the scale: five sorts, pairs of 20 filters and 50 result pages already make 47,500 URLs for one category. Then ask what the crawler already records that would show a site has stopped producing new pages, before deciding what to limit.
    Follow-ups

    From the lesson Design a web crawler

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  6. Mid to senior

    During a cup final, one topic receives 40 % of all mentions, and the partition that counts it falls minutes behind while the others are idle. Fix the counting without losing or double-counting mentions.

    What it tests
    Hot keys in a partitioned stream, combining counts in the producers, splitting a key with a final sum, and counting once when batches are retried.
    First step
    Size the problem: at an event peak of about 58,000 mentions a second, 40 % is about 23,000 a second for one key, which one consumer cannot count. Then decide where to combine the mentions: in each producer before the log, or after it, by splitting the key.
    Follow-ups

    From the lesson Design top-K trending topics

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  7. Senior to staff

    64 regional servers each send their top 10 topics to a global merger every minute. Explain why the global top 10 can be wrong, and design a merge that is exact.

    What it tests
    Why partial counts break top-k merges, over-fetching and its limits, an exact merge in rounds, and what that merge costs in pairs and in time.
    First step
    Build the counterexample first: a topic with a modest count in every region can have the largest total while it is in no region's top 10. Then ask what the merger knows about a topic a region did not send: only that its count there is at most that region's 10th.
    Follow-ups

    From the lesson Design top-K trending topics

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  8. Senior to staff

    5,000 accounts created last week each post the same hashtag every few seconds, and it reaches the top of the trends. Keep such campaigns out without hiding a real surge such as breaking news.

    What it tests
    Signals that separate organic from coordinated growth, counting distinct accounts with sketches, weighting accounts by history, and the cost of hiding real news.
    First step
    Compare the two shapes with numbers: the campaign makes 1,000 mentions a second from 5,000 accounts, about 12 per account a minute, while real news brings tens of thousands of accounts posting once or twice. Count distinct accounts and mentions per account before changing any score.
    Follow-ups

    From the lesson Design top-K trending topics

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  9. Mid to senior

    A suggestion that makes a false claim about a real person appears for a common prefix. Remove it everywhere within minutes, and make sure it does not come back with the next build.

    What it tests
    An emergency removal path that needs no build, every place a suggestion is copied to, normalised matching, and closing the gap in the pipeline.
    First step
    Separate the emergency from the fix: list where the suggestion is served from right now (the snapshot, the fast path, the CDN), and remove it from all of them without a build. Then ask which filter let it through.
    Follow-ups

    From the lesson Design search autocomplete

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  10. Senior to staff

    People type the same queries in Devanagari and in Latin letters, and each spelling gets only part of the popularity, so suggestions are weak in both. Design how suggestions are built and served for both scripts.

    What it tests
    Unicode normalisation for keys, grouping spellings across scripts from behaviour, a trie per script ranked by group totals, and measuring the quality of the grouping.
    First step
    Split the problem in two: equal-looking text with different code points, which normalisation solves, and one query in two scripts, which needs aliases learnt from behaviour. Then decide what each script's trie stores and how it is ranked.
    Follow-ups

    From the lesson Design search autocomplete

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  11. Mid to senior

    Right after a new suggestion snapshot was published, the suggest servers ran out of memory one after another. Explain what most likely went wrong, and how you would load snapshots safely from now on.

    What it tests
    The memory cost of loading beside the current snapshot, releasing the old one, rollouts that keep capacity, and checks before a swap.
    First step
    Do the memory arithmetic of the swap: while a server holds the current and the next snapshot, it needs twice the snapshot's size. Then compare the new snapshot's size with the old one, and ask whether every server started loading at the same moment.
    Follow-ups

    From the lesson Design search autocomplete

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  12. Senior to staff

    An account with 80 million followers posts during a cup final. Its followers open their home timelines within seconds, and its reply thread takes 40,000 replies a minute. Walk through the write and read paths and keep both under budget.

    What it tests
    Choosing push or pull for very large accounts, hot keys on the read path, a hot conversation, and fan-out lanes that do not block each other.
    First step
    Price the push first: 80 million inbox writes for one post is a minute or more of fan-out at a million writes a second, while every queued post waits. So the account is pulled. Then ask what the read path does when millions of readers merge the same short timeline and fetch the same post.
    Follow-ups

    From the lesson Design X (Twitter): timelines and search

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  13. Mid to senior

    During a final, search for the match hashtag must show posts within 10 seconds, but the indexers have fallen four minutes behind. Find the likely cause and restore freshness without losing posts.

    What it tests
    Reading consumer lag, the parts of the freshness budget, scaling indexers with log partitions, and degrading honestly instead of silently.
    First step
    Find which wait grew: compare each log partition's newest offset with the offset its indexer committed, and look at the age of the oldest post not yet indexed. Lag spread over every partition means too little indexing capacity; lag on a few means skew or a stuck consumer.
    Follow-ups

    From the lesson Design X (Twitter): timelines and search

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  14. Senior to staff

    A post has 2 million replies in 30,000 branches, and readers report repeated and missing replies while they scroll its conversation. Explain why, and design storage and pagination for the conversation view.

    What it tests
    Storing a reply tree by conversation and parent, cursors over a ranked list, bounded depth, and a stable order while ranks change.
    First step
    Reproduce the failure with two pages: page 1 is cut at a rank, new likes then move replies across the cut, so some repeat and others are skipped. Then decide what the order is for one reading session, and store replies so that a page is a short range read.
    Follow-ups

    From the lesson Design X (Twitter): timelines and search

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  15. Mid to senior

    Your index of 5 billion pages has to be split over 100 machines. Do you split it by page or by term? Defend the choice with what happens to a two-word query, a hot term and a lost machine.

    What it tests
    Document against term partitioning, query fan-out and intersection, hot spots, the impact of a failure, and scores that stay comparable across shards.
    First step
    Trace one query, "monsoon flood", through both layouts: by term it reaches two shards, but one may hold a huge postings list and the lists must meet somewhere to be intersected; by page it reaches all 100 shards, each intersecting locally. Then ask what each layout loses when one machine dies.
    Follow-ups

    From the lesson Design a simplified web search engine

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  16. Senior to staff

    Every query fans out to 100 index shards. Each shard answers within 20 ms at its own 99th percentile, yet queries take 400 ms at the 99th percentile. Explain the gap and bring it under 100 ms.

    What it tests
    Tail amplification in fan-out, hedged requests with cancellation, replica choice, partial results within a deadline, and measuring each shard's tail.
    First step
    Do the arithmetic: if each shard is slower than its 99th percentile on 1 % of requests, a query to 100 shards meets at least one such shard with probability 1 − 0.99^100, about 63 %. So the query's 99th percentile is set by each shard's far tail; measure that next.
    Follow-ups

    From the lesson Design a simplified web search engine

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  17. Mid to senior

    You poll 200,000 feeds. A few hundred publish every minute, most publish once a day, and some block you when you poll too often. Design the schedule so that wire stories appear within 5 minutes without overloading any publisher.

    What it tests
    Per-feed intervals learnt from each poll, conditional requests, politeness per host, honouring Retry-After and 429, and push through WebSub.
    First step
    Size the naive plan first: polling everything every minute is 3,333 requests a second, most of them wasted on feeds that change once a day. So intervals must differ per feed. Ask what each poll already tells you about a feed's change rate, and how to cap the load on one host.
    Follow-ups

    From the lesson Design a news aggregator

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  18. Senior to staff

    The home edition shows the same story 40 times: wire copies, light rewrites, independent reports and versions in three languages. Design the clustering so that each story appears once, with its sources listed.

    What it tests
    Exact repeats by id and link, MinHash with bands for copies, an event-level pass for independent reports, links across languages, and thresholds chosen with numbers.
    First step
    Sort the 40 into kinds before choosing a method: exact repeats share an id or a link, copies share most of their shingles, independent reports share facts but few phrases, and other languages share neither. Each kind needs its own check, applied cheapest first.
    Follow-ups

    From the lesson Design a news aggregator

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  19. Senior to staff

    A publisher retracts a story two hours after your aggregator showed it to 3 million readers in four language editions. What must change, how fast, and how do you design the system so that it is fast?

    What it tests
    Following updates and retractions from feeds, a fast path through clusters and editions, cache purging, and a visible record of corrections.
    First step
    List where the story lives now: the entry, its cluster, the cards in four editions, edge caches, apps that cached an edition, and notifications already sent. Then decide which of them the system can change within a minute and which only at the next fetch.
    Follow-ups

    From the lesson Design a news aggregator

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  20. Mid to senior

    A post goes viral: 8,000 votes a second land on it and 60,000 people a second open its thread. Votes time out and the page is slow. How do you record the votes, show the counts and serve the thread without overloading one row?

    What it tests
    One vote per person with a key, counters split across shards, counts that may lag, and caching a hot thread for readers who are not signed in.
    First step
    Split what must be exact from what may lag: each person's vote must be stored once, keyed by voter and item, but the count on the page can trail by a second or two. Then size the hot row: thousands of updates a second on one record is more than one row should take.
    Follow-ups

    From the lesson Design a Q&A forum like Quora or Reddit

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  21. Mid to senior

    Answers are sorted by upvotes minus downvotes, and people who write new answers say nobody ever sees them. Propose a ranking for the best answers and one for a community's front page, and show with numbers why each is fairer.

    What it tests
    Why net scores and averages mislead, a confidence bound on the share of upvotes, time in the score of a front page, and when scores are recomputed.
    First step
    Take two answers, one with 412 up and 96 down and a new one with 9 up and none down. Net score keeps the old one first forever, and an average would put a single upvote first. Ask what you really want to know about each answer, given how few votes some of them have.
    Follow-ups

    From the lesson Design a Q&A forum like Quora or Reddit

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  22. Senior to staff

    A moderator removes a harmful answer, but it stays visible for an hour: in the cached thread page, in search results and in the apps of people who loaded it earlier. Design removal so that it takes effect everywhere within a minute.

    What it tests
    Every place a copy lives, a state change instead of a delete, events that reach caches and search, cache lifetimes as a backstop, and proving the removal finished.
    First step
    List every copy: the row in the store, the thread cache, the CDN's pages, the search index, the community's ranked lists and the apps that loaded it. Then decide which of them the read path can check against the source of truth, and which must be told to forget.
    Follow-ups

    From the lesson Design a Q&A forum like Quora or Reddit

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  23. Mid to senior

    Two people like each other within the same millisecond. Likes are stored on 64 shards by the person who swipes, and each server checks for the other like after storing its own. Show how the match can be lost or duplicated, and design detection that always creates exactly one.

    What it tests
    Reasoning about interleavings, why a check across shards and followers can miss, keying both likes of a pair to one record, and side effects that happen once.
    First step
    Write the two servers' steps side by side and try the orders: if both checks run before either like is visible, nobody creates the match; if both run after, both create one. Then ask which single store could see both likes of the pair.
    Follow-ups

    From the lesson Design dating matches like Tinder

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 4 minutes
  24. Senior to staff

    A security researcher reports that three fake accounts can find where any of your users lives, using only the distance your app shows on each card. Explain the attack, and redesign how distances are computed and shown.

    What it tests
    Trilateration, why rounding a precise distance still leaks, coarse positions as the fix, the same rule in filters, and limits on probing.
    First step
    Draw the attack: each shown distance puts the user on a circle around a fake account that the attacker can place anywhere, and three circles meet at one point. Then ask what the attacker can still learn after you round the number, and what every answer would have to depend on to stop the leak.
    Follow-ups

    From the lesson Design dating matches like Tinder

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  25. Senior to staff

    On a festival night, deck builds in the centre of a city of 10 million people take seconds and time out, while the rest of the country is fine. Find the likely cause and fix it without making decks worse.

    What it tests
    Read cost that grows with density, hot cells on a few shards, rings that stop early with a correct radius, splitting hot cells, and serving older decks under load.
    First step
    Compare how many people one deck build reads in the centre with how many it reads elsewhere, and how many builds start there at that hour. Then check whether the busiest cells also sit on a few shards of the cell index.
    Follow-ups

    From the lesson Design dating matches like Tinder

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes

All System Design (High-Level Design) interview questions · The System Design (High-Level Design) track

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.