Twitter HLD: Fan-Out, the Celebrity Problem, and Merging a Timeline
A Twitter / X news feed system design (HLD): fan-out on write vs read, the celebrity problem, the push-pull hybrid, and assembling a timeline by merging K sorted streams at scale.
"Design Twitter." The single most-asked system-design question, and for good reason: it looks trivial — post a tweet, show a timeline — and the moment you start drawing, it splits open into the deepest trade-off in feed design. You follow 800 accounts. You pull to refresh and a perfectly time-ordered feed appears in 100 milliseconds. Multiply that by 300 million users refreshing all day, and the naive answer — "query every tweet from everyone I follow, sort by time, take the top 50" — is a query that would run thousands of times a second against billions of rows. It cannot work. And then the i…
What’s inside
Read this one free
Sign in and your first premium article is on us — read Twitter HLD: Fan-Out, the Celebrity Problem, and Merging a Timeline free.