Build the real-time Trending Topics service that powers Twitter Trends, TikTok "Trending", YouTube Trending, Reddit "Hot", Twitch "Top Streams", or Pinterest's trending pins. Engagement events stream in at scale; the system maintains the top-K most-mentioned entities over multiple sliding time windows (1 m, 5 m, 1 h, 24 h), per locale, and exposes a read API that the product surface polls every app cold-start. The algorithmic core is Count-Min Sketch (Cormode & Muthukrishnan 2005) for the long tail plus HeavyKeeper / Space-Saving (Gong 2018 / Metwally 2005) for the top-K maintainer, wired into Apache Flink's sliding-window keyed-state machinery and the Kappa architecture (Kreps 2014) for replay.
The hard part is not the sketches — it's everything around them: viral hot keys breaking partitioning, watermark stalls under regional Kafka producer lag, abuse-driven brigading inflating fake trends, UI jitter from counter-noise swaps, and the 100 ms read-SLO that has to survive a Redis shard restart. This canonical is what a staff SRE team would actually deploy: 15 components, full long-form internals, transaction-aware emit pipeline, and an on-call ergonomics story.