SD-13 · TOP SHARED ARTICLES · INTERACTIVEBreak it.
Break it.
Then fix it.
Turn up the shares, watch the counters melt, and add the parts a real “Most shared” box needs. In a spike one article takes 30% of all shares, and every switch is a decision you would defend in an interview.
CHALLENGEHandle 100K shares/s with the 5-minute list under 10 s behind, no dropped events and no lost counts.
StatusDOWNAt 50K shares per second
5-minute list lag60+ sTarget under 10 s
Dropped events50%Shares not counted
Monthly cost$2,730One counter
ReadersLIVE
50K shares/s · 10K list reads/straffic source
Top-K API × 4HOT
Reads precomputed lists10K / 12K reads/s
Result cacheOK
Top 100 per window3 lists · 10 KB each
Share API × 8OK
Forwards every event50K / 160K events/s
CheckpointsOK
State + offsets every 30 s≈ 190 MB a shard
CounterDOWN
Time buckets50K / 25K events/s
One counter can’t keep up. 50K shares a second is past what one process counts. Put a log in front, split it by `article_id`, and give each of 16 shards its own articles; a merger combines their top 100s exactly.
30%One article in a spikeSkew, not volume, is what breaks a partitioned counter.
8/sRecords for a viral articleAfter summing for 1 second on each of 8 Share API servers.
3 GBLive counting stateBuckets for 10 million articles, so exact counts are affordable.
16 × 100Entries the merger readsEach article lives on one shard, so the merged top 100 is exact.
Want the reasoning behind every switch?Visual walkthroughFull write-up
Was this lab useful?Your vote tells us what to improve next.