Design a URL Shortener (TinyURL): Interactive System Design
URL Shortener
Guided ModeStep 6 β Production-Ready Scale
Traffic doubles. What changes? Nothing β you just add components. That's the power of the architecture we've built.
Request Flow
Scale API layer: add more servers
The Load Balancer automatically distributes traffic across all healthy API servers. Add API Server 3 β LB starts routing to it immediately.
Cache absorbs 97% of redirects
As the cache warms up, hit rate climbs to 97%+. The Redis Cache now absorbs almost all redirect traffic before it touches the DB.
Read replica handles cache misses
Cache misses route to the DB Replica (read-only copy). The Replica handles all SELECTs; the Primary handles only INSERT/UPDATE (new URL creation).
This system handles millions/min
With 3 API servers Γ 1,000 RPS capacity, + 97% cache hit rate, + read replica β the full system handles ~100,000 redirects/second at <10ms p99 latency.
Why We Need This
Each component was added in response to a specific bottleneck β not speculatively. This is how Bitly, TinyURL, and every production URL shortener actually scales.
The key is incremental: cache before replicas, replicas before sharding. Each step handles 10Γ more load than the previous.
Key Insight
The entire URL shortener system β handling millions of redirects/minute β costs under $1,000/month. Incremental architecture decisions, not premature over-engineering, are what make this economics work.
Step 6 of 6
