Skip to content
SD-6 · MICROBLOG TIMELINE · INTERACTIVE

Break it.
Then fix it.

Turn up the readers, watch what melts, and add the parts a real microblog needs. Every switch is a decision you would defend in an interview.

CHALLENGEServe 300K timeline reads/s with p99 under 200 ms, posts under 500 ms and no errors.
StatusDOWNAt 50K timeline reads per second
Timeline p99500+ msTarget under 200 ms
Post p994,500 msTarget under 500 ms
Errors96%Requests being dropped
Monthly cost$8,520Timelines by query
ReadersLIVE
50K reads/s · 2.5K tweets/s
traffic source
Load balancerOK
Autoscales app servers
spreading 55K/s
App servers × 40OK
Stateless
55K / 80K calls/s
Tweet storeDOWN
Timeline query + tweets
2.5M reads · 5.0K writes/s
Every timeline is a big query. Building a timeline from 200 followed accounts costs about 30 index reads, plus 20 tweet reads. Push each new tweet’s ID onto its followers’ cached timelines instead.
20 : 1Reads to tweetsSo we pay at write time to make reads a memory lookup.
200Followers per tweetOn average, with huge accounts pulled instead of pushed.
22.5M/sInserts if we push everyoneHuge accounts lift the average to 1,500 per tweet.
95%Tweet cache hits19 of a page’s 20 tweets come from memory.
Want the reasoning behind every switch?Visual walkthroughFull write-up
Was this lab useful?Your vote tells us what to improve next.