Design a system that tracks read events for every article on a news website and supports two key operations:
IngestReadEvent(articleId, timestamp) – called every time any user reads an article. The system must accept tens of millions of these write events per day (high write throughput).
GetTopKMostReadArticles(k, timeWindow) – return the k most frequently read articles in the last timeWindow (e.g., last hour, last day). timeWindow is limited to tumbling windows of 1 hour, 1 day, 1 month, or “all-time”; k ≤ 1 000. Queries must return in < 100 ms (low read latency).
The design should be scalable to global traffic, fault-tolerant, and cost-efficient. You must explain how you handle hot articles that receive millions of reads, how you aggregate counts over sliding time windows, and how you keep read and write paths performant.