Skip to main content
A simplified reconstruction of the Twitter timeline from Raffi Krikorian’s “Timelines at Scale” talk; numbers are illustrative. Tweets fan out on write into precomputed timelines, so reads are one cache hit; every 20s a celebrity tweet dumps 200 fanout jobs on the firehose. Past 2x the fanout group never catches up again: reads stay green while timelines quietly go stale, and only the consumer lag tells the truth.

What to watch

Reading a timeline is cheap because the answer was written in advance. 300 reads a second are almost all served straight from cache; only a miss goes back to look up who you follow and rebuild it. Turn the load up to 2x and watch the fan-out workers. One tweet means one insert into every follower timeline, about 120ms each, and only eight run at once. They fall behind and never catch up, so timelines go stale while every read still comes back fast and green. Every 20 seconds a famous account tweets, and that one tweet becomes 200 fan-out jobs at once. This is why very large accounts get handled differently from everyone else.

What it is made of

Under load

Measured by running this design through the simulator at multiples of its own offered rate of 330 requests a second. Twenty seconds of simulated time, one fixed seed, so the same numbers come out every time.
This design holds 990 requests a second with 0% errors. At 1320 it is losing 3% of them.

Open this example

Load Twitter/X: timeline fan-out from the Examples menu and drag the traffic slider yourself.