Design a URL Shortener
EasyBuild a scalable service that converts long URLs into short, memorable links.
Interviewer
Design a URL Shortener
You're designing a URL shortening service like bit.ly or TinyURL. The system enables users to paste a long URL and receive a short, memorable alias (e.g., https://short.app/abc123). Every shortened link redirects to the original URL. You track click counts for analytics.
Scale assumptions:
- 100 million daily active users (DAU)
- 20% are creators (those who shorten URLs); 80% are readers
- Creators generate ~2 new shortened URLs per day on average
- Readers access shortened links ~5 times per day on average
- Each shortened URL record: ~500 bytes (slug, original URL, metadata)
- Target latency: <100ms for redirect, <200ms for creation
- Availability: 99.95% uptime
Derived numbers:
- New URLs: 100M × 0.2 × 2 = 40M/day ≈ 460 writes/sec average, ~1,500 peak
- Accesses: 100M × 0.8 × 5 = 400M/day ≈ 4,600 reads/sec average, ~15,000 peak
- 5-year URLs: ~73 billion
Sign in to start the interview.
The interviewer grades each stage against a hidden rubric and asks a probing follow-up, mirroring a real system design round. Sessions are capped at 30 turns.