← All Problems
EasyWeb Services35 min
Design a URL Shortener
Design a service like TinyURL or bit.ly that shortens long URLs into compact links.
GoogleAmazonMicrosoftMeta
Functional Requirements
- Given a long URL, generate a short unique alias
- When users access the short URL, redirect to the original
- Links can optionally expire after a default timespan
- High availability and low latency for redirection
- Analytics: track click counts per short URL
Steps (0/6)
Step 1: Clarify Requirements & Scope
Start by asking clarifying questions. How many URLs per day? What's the read vs write ratio? Do we need custom aliases? Should links expire? What about analytics?
Typical numbers: 100M new URLs/day, read-heavy (100:1 ratio), ~10B redirections/day.
Key Points
- Write: ~100M URLs/day → ~1200/sec
- Read: ~10B redirections/day → ~115K/sec
- Storage: 100M × 365 × 5 years × 500 bytes ≈ 91 TB
- Read-heavy system, optimize for reads
1 / 6