# Home timeline - materialise it, then keep it honest

> Why one post is fanned out into hundreds of precomputed timelines, and why the celebrity cannot be. Every timeline here is a denormalised copy that nothing…

Source: https://tierslate.com/templates/twitter-timeline

Social & feeds · System design · core · 8 step walkthrough · 5 tables

Why one post is fanned out into hundreds of precomputed timelines, and why the celebrity cannot be.

**Own this board: 400 credits.** The first act plays on the page. Owned once with credits, never a subscription.

## What this board gets wrong on purpose

The tension: Every timeline here is a denormalised copy that nothing repairs. Deletes, blocks, mutes, unfollows and gone-private accounts never travel back into the 150 million lists that already hold those ids, so the read path fetches rows in order to throw them away - which means a timeline gets SLOWER the longer an account has existed, and a page of twenty tweets can require hydrating sixty. The trim is the second half of it: past eight hundred ids the materialised timeline simply does not exist, so deep scroll falls through to a query path that is barely exercised, has no cache behind it, and is the one nobody load tests.

## Practise this as an interview

Take Home timeline - materialise it, then keep it honest as a timed system design interview on a blank board - on your own, with the requirements to check yourself against, or with a candidate you invite.

## Start here

### Why this design

The home timeline is the canonical fan-out question: one write must become visible to hundreds of readers, and the follower distribution is so skewed that no single strategy survives both the median account and the largest one. Interviewers use it to probe whether you size by the amplified number rather than the request rate, and whether you can see what a precomputed, denormalised copy costs to keep correct. Every social feed, activity stream and notification inbox inherits the same trade.

### What you will learn

- Why fan-out on write turns 2,300 tweets/s into 463,000 list writes/s, and why that - not the tweet rate - sizes the system.
- Why the lists hold**ids, not bodies**, trimmed to 800: 2.9 TB of RAM instead of 28.8 TB, and what the trim leaves behind for deep scroll.
- How the hybrid works as**data**: an exclusion list of authors who are never fanned out and are pulled live at read time.
- Why hydration, not the 52,000 timeline reads/s, sizes the tweet store at 3.1M fetches/s - and why the storage-layer read:write ratio collapses to about 2:1.
- Why the visibility filter is the price of the copy, and why it is the one stage that must fail the request rather than degrade.
- Why the read path gets 99.95% and the write path 99.9%, and how timeline shards are split without a big-bang reshard.

### How to read this board

1. Diagram, top left first: COMPOSE · ONE WRITE, then FAN-OUT ON WRITE · ONE WRITE BECOMES N beneath it, then WHAT THE READ PATH MERGES on the right.
2. Then READ · BUILD ONE TIMELINE, FIVE HOPS along the bottom of the diagram, left to right. Press play for the eight-step walkthrough.
3. THE DATA MODEL under the diagram: users, tweets, follows, the materialised timeline_entries and the excluded_authors list.
4. Page 1 · Requirements - the questions to ask first, starting with chronological or ranked.
5. Pages 2 and 3 · Capacity and Storage estimation - fan-out amplification, hydration load, and what the 800-entry trim saves in RAM.
6. Page 4 · Availability - different targets for read and write, and what degrades rather than dies.
7. Page 5 · How it works, then Page 6 · Deployment plan, including resharding the timeline store.
8. Then the conversation to have: every timeline is a copy that nothing repairs, so deletes and blocks are paid for at read time, and past 800 ids the timeline falls through to an uncached path nobody load tests.

## 1 · Requirements

### Clarifying questions to ask first

- Is the timeline**chronological or ranked**? Ranking changes everything: a chronological timeline can be a pure merge, a ranked one needs features at read time and cannot be trimmed by time alone.
- How**stale**may a timeline be? Seconds, or is a missing tweet a bug?
- Do we owe**read-your-own-writes**? Seeing your own tweet immediately is the one staleness users notice within a second.
- What is the**follower distribution**? The p50 and the p99.99 are six orders of magnitude apart and they need different machinery.
- Are there**private accounts, blocks and mutes**? Each one turns a precomputed list into a list that must be re-checked at read time.
- Is**deep scroll**a product requirement, or may the timeline simply end?

### Functional

- Post a tweet; it appears in the home timeline of every follower.
- Read a home timeline: the most recent tweets from the accounts you follow, ranked, paginated.
- Follow and unfollow; the effect on the timeline may be eventually consistent.
- Delete a tweet; it must stop being served.
- Blocked, muted and protected authors must not appear.

### Non-functional

- **Timeline read p99 under 200 ms**at the API, measured server-side.
- **Fan-out lag p99 under 5 seconds**from post to a follower list, for ordinary accounts.
- **99.95% availability**on the read path. The write path may be less available: failing to post is visible and recoverable, failing to read is the product being down.
- **Eventual consistency is acceptable**for other people's tweets. Read-your-own-writes is not negotiable.
- Deletes and blocks must take effect**within one request**, not within one TTL.

### Explicitly out of scope

Search, direct messages, notifications, media upload, ads insertion, and the ranking model itself. The ranker is drawn as one box because its internals are a different board.

## The rest of this board

This page publishes the question. The answer - 5 more written pages, an 8-step narrated walkthrough and a 5-table schema - is the board itself, and it opens in Tierslate.

- 5 written pages
- 8 walkthrough steps
- 5 tables (22 columns)

5 pages behind this one:

- Capacity estimation
- Storage estimation
- Availability
- How it works
- Deployment plan

## Related system design templates

- [Social news feed system design](https://tierslate.com/templates/news-feed) - Fan-out on write against fan-out on read, and when each loses.
- [Media feed system design](https://tierslate.com/templates/instagram-feed) - Why the feed serves URLs and the edge serves bytes, and who actually pays for the pixels.
- [The professional graph system design](https://tierslate.com/templates/linkedin-connections) - Why a degree badge on every name is a graph held in memory and searched from both ends, not a join.
- [Comment trees system design](https://tierslate.com/templates/reddit-comments) - How a whole comment tree comes back in one range scan, and why every vote rewrites what it cached.
- [The social graph system design](https://tierslate.com/templates/social-graph) - Why every follow is written twice on two shards with no transaction between, and what that drift costs.
- [Blog platform system design](https://tierslate.com/templates/blog-platform) - Why a blog is a read-heavy system where the cache is the product, and what publishing has to invalidate.
- [Link previews system design](https://tierslate.com/templates/link-preview) - Why unfurling a pasted URL is a server-side request forgery problem first and a caching problem second.
- [Reviews and ratings system design](https://tierslate.com/templates/reviews-ratings) - Why a star rating is an aggregate maintained on write, and how fake reviews are held back before they count.
- [Content moderation system design](https://tierslate.com/templates/content-moderation) - Why moderation is a fast automatic gate plus a slow human queue, and what is shown while it decides.
- [Stories system design](https://tierslate.com/templates/ephemeral-stories) - Why expiry is a read-time filter plus a background sweep, and why the viewer list is the expensive part.

All 100 system design templates: https://tierslate.com/templates (Markdown: https://tierslate.com/templates.md)
