SYSTEM DESIGN SKETCHBOOK / PRACTICE SHEET / NO. 22
Design top charts for an app store
An app store shows "Top Free", "Top Paid" and "Top Grossing" charts for every category in every country. Developers watch their rank closely because a spot in the top 10 brings a lot of new installs, which also makes the charts a target for people who buy fake installs.
Requirements
- Publish the top 200 apps for each chart type, category and country, plus an all-categories chart.
- Rank apps by recent demand (installs for free charts, purchases or revenue for paid and grossing), with recent days weighing more.
- Keep installs judged fraudulent out of the rankings, including when the verdict arrives late.
- Show an app's current rank on its page, and keep a daily history of ranks.
Constraints and assumptions
- 3 million apps, 60 categories, 150 countries, 3 chart types: about 27,000 charts.
- 500 million install and purchase events per day, peaking at 20,000 per second.
- Charts are recomputed once an hour; a published set of charts must switch over all at once.
- Chart pages are read 50,000 times per second at peak.
- Fraud verdicts can arrive up to 48 hours after the install.
Out of scope for the first sketch
Personalized recommendations · Search ranking · The fraud detection models themselves
Draw your design
Rough math and notes
SYSTEM DESIGN SKETCHBOOK / FOLLOW-UPS
Design top charts for an app store
Finish your first sketch before answering these. Cross out freely.
- Why not rank by raw installs in the last 24 hours? What score would you use instead?
- A developer buys 200,000 installs from a device farm over two hours. How do you keep them off the chart, and what happens if detection only arrives a day later?
- Two apps swap ranks 5 and 6 every hour because of noise. How do you keep the order stable without hiding real movement?
- What exactly does the hourly job compute for 27,000 charts, and how long should it take?
- A shopper is paging through a chart when a new hour's charts are published. How do you keep them from seeing duplicates or skipped apps?
Compare afterwards: worked approaches and reading at sketchbook /questions/top-k-rankings/review