Design a Top K / Trending Topics System
hard 45 minCount billions of mentions a day and show the ten topics that are rising right now, in each country and city.
Where it shows up
The same pattern appears across everyday software.
Breaking news
An earthquake is felt and mentioned by thousands within a minute. A list that is an hour old is worse than none.
Search suggestions
Rising searches are offered before the user types. The same counts feed [search autocomplete](/learn/system-design/search-autocomplete).
Redis Top-K
Redis offers a top K structure. Its documentation says it is based on the HeavyKeeper idea: counters decay so small items fade, next to a small heap of the largest.
Network traffic
Operators look for the addresses that send the most packets. Streams of packets are where many heavy hitter methods were first used.
Shops
Best sellers of the last hour. Orders are few, so exact counts in a database are enough.
Elections and campaigns
A visible list attracts groups who try to fake it. Such topics get stricter limits and a person's review.