System Design Simulator
URL Shortener
Design a service that creates short links and redirects at high read volume.
Al Beltran Engineering Lab
Loading simulator…
How the challenge works
- Redirects dominate writes. Cache the mapping and keep the write path small.
- IDs need uniqueness and some entropy. Sequential IDs leak volume and are guessable.
Key concepts
Read-heavy mapping
A short link is a tiny key-value record. Most traffic never needs a join or a search index.
Cache before replicas
A replica helps failover. A cache and CDN absorb the 100M redirects.
Common mistakes
- Putting Elasticsearch in front of a two-column lookup.
- Hitting the primary database on every 301.
Recommended architecture
- Client → CDN/API → cache → database. Rate-limit create. Optional replica for reads if cache misses spike.
Interview tips
- Estimate QPS and key size before you draw boxes.
- Call out analytics as async — do not write a click row on the redirect path.
Related challenges
Built by Al Beltran