System Design Lab
A URL shortener is a read-heavy key-value lookup that outgrows one box from the read side first.
Change redirect and create rates, how many links are stored, hot-link skew, the short-code length, latency target, and regions. The design moves from a single database to cache-aside reads, a dedicated key-generation strategy, a sharded KV store, and multi-region edge redirects.
Guided walkthrough
Reason about it one step at a time
Takeaway
Normal evolution scenarios
Click left to right for the intended demo path. Each card changes the workload inputs.
Recommended shape
Bottlenecks
Why this changes
Decision tradeoffs
Source-backed rules
These are the durable system-design claims behind the model. The exact slider thresholds are deliberately labeled as teaching assumptions.
A URL shortener is dominated by reads (redirects), not writes
The canonical write-up treats redirect lookups as the high-volume path and link creation as comparatively rare, which is why read scaling comes first.
System Design PrimerCache-aside keeps hot reads off the database
The cache-aside pattern loads items into a cache on demand; for skewed redirect traffic a small cache absorbs most lookups.
Azure ArchitectureRedis is a common in-memory store for hot key-value lookups
In-memory point lookups serve popular short codes at sub-millisecond latency, far below a disk-backed store.
Redis DocsA CDN serves cacheable responses from locations near the user
Redirects for popular links are cacheable at the edge, cutting cross-region round trips for a global audience.
AWS CloudFrontTeaching assumptions
- Redirects are modeled as cacheable point lookups; cache hit rate is approximated from the hot-link share.
- Single-node read, write, and storage budgets are conservative teaching numbers, not vendor limits.
- Code keyspace fill uses base62^length; real systems also reserve key ranges per ID server to avoid collisions.