URL Shortener — High-Level Design & Live System Simulator
Watch a request travel end-to-end through a real URL shortener architecture. Run the write path, a cache hit, a cache miss, and a Redis failover — then stress it with a traffic burst and read what every hop does.
Step log
Why this design works
A URL shortener is a read-heavy system — redirects outnumber new short-link creations by roughly 100:1. The architecture above optimizes for that skew: a Key Generation Service (KGS) pre-allocates unique keys so writes never need a collision check, Redis absorbs the vast majority of reads in sub-millisecond time, and the sharded KV database is only touched on a cache miss or a new write.
Click analytics are decoupled entirely — every redirect fires a non-blocking event onto Kafka, so the user-facing 302 response is never held up by analytics processing. When Redis fails, the system degrades gracefully by falling through to the database directly, favoring availability over strict consistency (an AP trade-off), so short links keep resolving even during a cache outage.