Twitter/X Timeline: Interview Perspective
How to approach 'Design Twitter's timeline' in a system design interview — the opening move, key components, the celebrity problem moment, and what distinguishes a strong answer.
Opening Move
There isn't one memorized "strongest opening" to recite — but there is a natural sequence that consistently sets up the rest of the conversation well.
1. Clarify scope: does the interviewer want the Home/Following timeline specifically, or does this also need to cover search, notifications, or a For You-style recommendation feed? 2. Establish scale and workload assumptions — rough user counts, posting rate, read-to-write ratio. 3. State freshness/consistency requirements out loud — does a new post need to appear instantly, or is a short delay acceptable? 4. Identify the follower-distribution skew: most accounts have modest follower counts, but a small number have an enormous, unbounded following. That skew is what makes this problem genuinely hard, not just large.
Interview Roadmap
Rather than re-explaining every concept here, use this as a roadmap for the order a strong answer typically covers — each step links to where the real depth lives.
1. Requirements and scope — see Complete Design → Requirements. 2. The naive read-time approach and where it breaks — see Complete Design → Start Simple. 3. Fanout-on-write — see Complete Design → Fanout-on-Write. 4. The celebrity counterexample — see Complete Design → The Celebrity Problem. 5. The hybrid strategy — see Architecture Deep Dive → Hybrid Fanout Strategy. 6. Candidate composition — see Architecture Deep Dive → Candidate Generation & Feed Composition. 7. Ranking and caching — see Architecture Deep Dive → Ranking Pipeline and → Multi-Layer Feed Caching. 8. Failure and scale discussion — see Failure & Scale Scenarios.
The Celebrity Problem — The Key Moment
The celebrity problem is the pivot point of the whole discussion — the moment where a uniform strategy visibly breaks and a real design decision becomes necessary.
Don't wait for the interviewer to push back on fanout-on-write — raise the problem yourself. The reasoning matters more than the exact numbers: an account with an extremely large follower count would create a proportionally enormous number of inbox writes from a single post, which risks overwhelming the fanout queue and delaying delivery for everyone else's posts too, not just that author's.
Then present hybrid fanout as the response to that specific problem. This arc — problem → consequence → solution, reasoned aloud rather than recited — is what distinguishes someone actually thinking through the trade-off from someone who has memorized an architecture diagram.
Reasoning Patterns
Memorizing polished quotes doesn't transfer well to a live interview, where follow-up questions quickly reveal whether the reasoning behind a statement was ever actually understood. A repeatable reasoning pattern transfers much better.
The pattern: state an assumption explicitly, identify the bottleneck that assumption creates, quantify just enough to show why it matters (a rough order of magnitude, not a precise benchmark), present the realistic alternatives, choose one based on the assumed workload — not because it's universally "correct" — and acknowledge the failure mode or trade-off the choice still carries.
Worked Examples
On consistency
Assumption: users tolerate a short delay before a post appears in followers' feeds. Bottleneck: synchronous fanout to every follower before confirming a post as "created" doesn't scale. Alternative: eventual consistency with asynchronous fanout. Choice: asynchronous fanout, because the tolerance for delay is what makes it viable in the first place — not because eventual consistency is inherently superior.
On hot partitions
Assumption: traffic can concentrate sharply on a small number of keys during a viral event. Bottleneck: adding generic capacity doesn't redistribute an already-hot key. Alternatives: cache absorption, read replicas, explicit key sharding. Choice: apply them in that order, escalating complexity only as needed — layering rather than reaching straight for the most complex fix.
On ranking
Assumption: the ranking approach will change far more often than the fanout/candidate-collection architecture. Bottleneck: coupling them tightly would force every model iteration to risk the delivery pipeline. Alternative: keep them as separate services connected by a stable interface. Choice: decouple, acknowledging the trade-off of an extra network hop and some added latency in exchange for independent deployability.
Question Bank: Likely Questions & Follow-Ups
The sections above teach you how to run the conversation. This section covers the other half: what actually gets asked, the realistic follow-ups an interviewer uses to push past a first answer, and what each follow-up is really testing. Each entry links to the relevant technical page for mechanics rather than re-explaining them here.
Category A — Scope & Requirements
"Design Twitter/X's home timeline."
Don't guess at scope — this is a clarification moment, not a design moment. Confirm whether this is the Following feed, a For You feed, or both, per Opening Move.
- "Are we designing Following or For You?" — Tests whether the candidate treats these as genuinely different candidate-source problems rather than one interchangeable feed.
- "Does a new post need to appear immediately?" — Tests whether the candidate connects this answer to a specific consistency choice, not just a general preference.
- "How many accounts can a user follow?" — Tests awareness that an unbounded following count is exactly what makes naive read-time generation fail.
- "Do we need replies/reposts in the feed?" — Tests whether the candidate recognizes this expands candidate sources and dedup rules rather than being a free addition.
Category B — Fanout
"How do followers receive a newly created post?"
Walk through fanout-on-write, per Fanout-on-Write, then explain why it alone doesn't scale to every account.
- "Why not generate every timeline at read time?" — Tests whether the candidate can articulate the O(accounts followed) read cost, not just recite that it's slow.
- "What happens if the author has 50M followers?" — Tests whether the candidate identifies write amplification as the actual bottleneck, not just 'it would be a lot of writes.'
- "How do you decide push vs pull?" — Tests awareness of the Fixed vs Adaptive Fanout Policy decision.
- "What if the author crosses the threshold?" — Tests understanding of strategy transitions, not just the steady-state cases.
Category C — Queue & Delivery Correctness
"What if a fanout job is processed twice?"
Explain the idempotency key concept from Fanout Queue & Worker Architecture — using the post ID as the inbox member makes a repeated write a no-op.
- "How do you make fanout idempotent?" — Tests whether the candidate names the specific (timeline_owner_id, post_id) uniqueness, not just the word 'idempotent.'
- "What if the worker crashes halfway through a follower batch?" — Tests understanding of chunked, checkpointed fanout rather than one giant atomic job.
- "How do you know which followers already received it?" — Tests whether the candidate connects this back to checkpointing progress per batch.
- "How do you recover from a six-hour backlog?" — Tests awareness of controlled drain rate and backlog-age SLOs, per Fanout Backlog / Partial Delivery.
Category D — Social Graph
"How do you efficiently find all followers of an author?"
Point to Social Graph Access Patterns — this is an adjacency-list style access pattern, paginated for high-degree nodes.
- "What if the author has 100M followers?" — Tests whether the candidate reaches for paginated traversal rather than assuming a single query returns everything.
- "How is this different from finding who a user follows?" — Tests whether the candidate distinguishes the two access directions rather than treating them as the same lookup.
- "Would you use a graph database?" — Tests whether the candidate over-commits to one storage technology rather than recognizing the access pattern is what matters.
- "What happens if the Social Graph service is down?" — Tests failure-mode reasoning, per Social Graph Service Unavailable.
Category E — Candidate Generation & Ranking
"What exactly does the ranking service rank?"
Explain that ranking always operates on a bounded candidate pool, per Candidate Generation & Feed Composition, not every post in the system.
- "Do you send every post from every followed account into the ML model?" — Tests whether the candidate separates candidate generation from scoring, a common conflation.
- "How do you keep candidate count bounded?" — Tests understanding of merge/dedupe/discard steps before ranking ever runs.
- "Where do filtering and deduplication happen?" — Tests whether the candidate connects this to Post Lifecycle, Deletion & Visibility.
- "What if ranking takes 500ms?" — Tests timeout-budget reasoning, per Ranking Service Unavailable.
Category F — Pagination
"How do you paginate an infinite, continuously changing timeline?"
Explain why offset breaks down and present the cursor model, per Feed Pagination & Stable Scrolling.
- "Why not OFFSET/LIMIT?" — Tests whether the candidate can explain instability against a changing dataset, not just state that it's 'bad practice.'
- "What if new posts arrive between page 1 and page 2?" — Tests whether the candidate reasons about a stable snapshot or materialized result as the fix.
- "What if ranking scores change?" — Tests recognition that ranked-feed pagination is genuinely harder than chronological pagination, not the same problem.
- "How do you avoid duplicate posts?" — Tests whether the candidate connects this to client- or server-side deduplication as a practical mitigation.
Category G — Post Deletion & Visibility
"A post has already been pushed into 10 million timeline inboxes and is then deleted. What happens?"
Explain serving-time validation, per Post Lifecycle, Deletion & Visibility — correctness comes from read-time filtering, not synchronous cleanup everywhere.
- "Do you delete it synchronously from all 10 million inboxes?" — Tests whether the candidate recognizes this as unnecessary and expensive, and proposes async cleanup instead.
- "What if the author blocks the reader?" — Tests whether the candidate generalizes the same read-time filtering mechanism to a different visibility trigger.
- "What if the account becomes private?" — Tests the same generalization again — one mechanism, several triggers.
- "How quickly must deletion propagate?" — Tests the distinction between correctness now (read-time filtering) and cache-invalidation speed as a separate, secondary concern.
Category H — Cache & Failure
"What happens if Redis/timeline cache goes down?"
Walk through Timeline Cache Fails — fall-through to composition, degraded-mode options, and stampede prevention on recovery.
- "Can the database survive every request becoming a miss?" — Tests whether the candidate reasons about downstream capacity limits, not just 'it falls through.'
- "How do you prevent a thundering herd when Redis recovers?" — Tests knowledge of jitter, request coalescing, and gradual warming.
- "Would you serve stale data?" — Tests whether the candidate offers a concrete degraded-mode option rather than treating 'serve nothing or serve everything fresh' as the only choices.
- "What functionality would you degrade first?" — Tests prioritization: chronological fallback and reduced page size before an outright outage response.
Category I — Rebuildability
"What happens if a user's timeline inbox is lost?"
Explain derived-state rebuild, per Timeline Inbox Lost / Redis Cluster Loss — posts are never at risk, only the precomputed candidate structure.
- "Is the inbox source of truth?" — Tests the source-of-truth-vs-derived-state distinction directly, per Data Ownership & Storage Model.
- "How would you rebuild it?" — Tests whether the candidate names a concrete rebuild source (recent posts from followed authors) rather than a vague 'recompute it.'
- "Would you rebuild all users immediately?" — Tests prioritization and rate-limiting reasoning, not an uncapped all-at-once rebuild.
- "What would the user see while rebuilding?" — Tests whether the candidate proposes a temporary read-time composition fallback rather than an outright error.
Category J — Scale Curveballs
"What changes if a user follows 5,000 accounts?"
Tests whether the candidate recognizes this stresses the pull/read side (fanout-on-read cost scales with accounts followed), the opposite pressure point from the celebrity write-side problem.
- "Would this change your fanout classification?" — Tests whether the candidate recognizes follower count and following count are different axes of the same fanout-cost question.
"What happens during a World Cup final when posting and reading spike simultaneously?"
Combine Celebrity Post Storm reasoning with general read-surge handling — write amplification is contained by hybrid fanout, but read-side and request-layer capacity still matter.
- "Which layer absorbs most of that surge?" — Tests whether the candidate names cache and read replicas specifically, not just 'the system handles it.'
"How would you support both chronological Following and ranked For You feeds?"
Tests whether the candidate keeps Following and recommendation feeds as separate candidate sources rather than silently merging them into one undifferentiated feed.
- "Do they share any infrastructure?" — Tests whether the candidate identifies shared components (ranking service, object cache) versus genuinely separate candidate-source logic.
"How would you handle a user who has not opened the app for six months?"
Tests whether the candidate reasons about a stale, likely-evicted or never-fully-populated inbox, and proposes read-time composition or a partial rebuild rather than assuming the precomputed inbox is simply ready to serve.
- "Would you keep pushing fanout to inactive users the whole time?" — Tests cost-awareness — pushing fanout to a user who never reads it is pure waste, worth reconsidering for very inactive accounts.
"What if one post becomes globally viral?"
Tests recognition that this compounds several scenarios at once — hot partition pressure on the object cache, celebrity-storm-style read pressure, and elevated ranking load — not a single isolated failure mode.
- "Would your mitigations from the individual scenarios still work together?" — Tests whether the candidate can reason about compounding failure modes, not just recite each mitigation in isolation.
"What would you simplify for an MVP with 1M users?"
Tests prioritization under constraint — a strong answer identifies that hybrid fanout classification, a full ranking model, and multi-layer caching are all scale-justified investments that could be deferred, while basic fanout-on-write and a durable Posts DB cannot.
- "At what point would you introduce each deferred piece?" — Tests whether the candidate ties each simplification back to a specific scale threshold rather than treating the MVP as a permanent design.
- 01State an assumption before defending a design choice built on it
- 02Quantify enough to justify a bottleneck's severity, not to sound precise
- 03Present real alternatives before naming the choice — don't skip straight to the answer
- 04Choose based on the assumed workload, not as a claim of universal correctness
- 05Acknowledge the remaining failure mode or trade-off of the choice made