URL Redirection System Design (Redirects, Routing & Analytics)
Your company operates a public URL shortener that is widely used in marketing campaigns, social media posts, and automated notification systems. Once a short URL is created, it may receive anywhere from a few clicks to millions of requests per day, often in sudden traffic spikes triggered by viral content or advertisements.
The redirection service sits directly in the critical request path for end users, meaning even small latencies or failures are immediately visible. The system is extremely read-heavy, globally accessed, and must continue serving redirects even when other parts of the platform are degraded.
Task: Design the backend service that resolves a short URL to its original long URL and performs the HTTP redirect.
Constraints
Resolve short code to long URL, perform HTTP redirect (301/302), support optional expiration and invalid/missing link handling
Low latency (< 100ms redirect), high availability, failure isolation from rest of platform, globally distributed reads
Extremely read-heavy; traffic from few clicks to millions per day per URL with sudden spikes; hot URLs dominate