SD-48 · LIVE COMMENTS · INTERACTIVEBreak it.
Break it.
Then fix it.
Turn up the viewers and watch the fan-out explode. Every switch is a decision from the write-up you would defend in an interview.
CHALLENGEServe 20M concurrent viewers, 30% of them on one live post, with comments on screen p99 under 2 s and nothing dropped.
StatusDOWNAt 5M viewers
Comment to screen8250 msp99, target under 2 s
Dropped96.7%Sockets or messages dropped
Monthly cost$20,90063 gateways
ViewersDOWN
5.0M watching · 1.5M on the hot post1.5K comments/s to each hot viewer
WritersLIVE
5.0K comments/s1.5K/s on the hot post
Gateways × 63OK
Batches every 500 ms5.0M sockets · 6.5M frames/s
Comment serviceOK
Filtered before publish5.0K writes/s
Broadcast busOK
Every comment to every gateway315K / 2.0M msgs/s
Comment storeDOWN
One leader5.0K writes · 17K reads/s
Nobody can read 1.5K comments a second. The hot post sends every comment to all 1.5M viewers, and their phones choke. Rank each second’s comments and send the best 10; every comment is still saved.
36B/sDeliveries without sampling6,000 comments a second to 6M viewers of one post.
10/sComments shown per viewerAbout what a person can read; every comment is still saved.
500 msBatch windowAt most 2 frames a second per viewer, for half a second of delay.
98%Cache hit rateOpens and reconnects ask for the newest comments of active posts.
Want the reasoning behind every switch?Visual walkthroughFull write-up
Was this lab useful?Your vote tells us what to improve next.