Question
Design a branded short-link + click-analytics service for a marketing platform (think a Bitly for enterprise). Scale: ~5K new links/day but ~200K redirects/sec at peak (links go viral), redirect latency must be <30ms p99 globally, and each redirect must record an analytics event (timestamp, geo, device, referrer) without slowing the redirect. Requirements: custom aliases with collision handling, optional expiration, and near-real-time click counts in a dashboard. The focus is the redirect hot path and analytics ingestion, not the ID-generation puzzle.
Clarify scale and constraints first. Propose a clean component breakdown, then go deep on the hard parts — data model, bottlenecks, consistency, failure modes — and name the trade-offs you are making.