LeetDesign
← All problems
Easy

Design a View Counter

Count page views for millions of pages. Fifty writes for every read, and no cache can absorb a write — the problem that makes you size the ingest path honestly.

Design a service that counts page views. Every page load on every customer site fires one hit; dashboards read the totals back.

The shape is upside down from most systems: writes outnumber reads fifty to one. Caches don't help — a count has to be recorded, not served — so the write path must be sized for the full stream. The contract is forgiving in exactly one place: losing up to a minute of counts in a crash is acceptable, and that leniency is worth money to whoever notices it.