The home screen of Tiffin has a strip called "Trending near you". It should show the 10 dishes ordered most in your city in the last hour. Simple, until you look at the input: an endless stream of order events, hundreds of thousands of distinct dishes, and a new answer needed every minute.
This is the heavy hitters problem: in a stream too big to remember, find the items that appear most often. The same problem shows up as "which keys are hot in the cache?", "which IPs are flooding the gateway?" and "which search terms are spiking?".
The exact way, and why it hurts
The obvious answer is a hash map from item to count, plus a heap to pull out the top 10.
That works until the number of distinct items gets large. Order streams have a long tail: a few thousand dishes get most orders, and hundreds of thousands get one or two. The map must hold every one of them, because any of them could become popular. For dish names that's maybe fine. For "which of 40 million IPs are hottest?" or "which of 2 billion cache keys?", it isn't.
What makes the problem solvable is that you don't need exact counts for everything. You need the big items, roughly right, and you need to never miss one.