bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths

Loading lesson path

Learn/System Design/Design a URL Shortener
System Design•Design a URL Shortener

Design a URL Shortener: Scaling

Design a service that turns long URLs into short links, redirects on access, and reports click counts.

How to approach it

Scale by following the request path and fixing the first real bottleneck. Reads usually dominate, so caching and replication come first; writes and storage are handled by sharding on a high-cardinality key. Push slow, retryable work onto queues. Add infrastructure only where the numbers justify it.

Scaling decisions

AreaChoice
CacheCache-aside hot codes in Redis with a long TTL
CDNCache 301 redirects at the edge
ShardingShard the KV store by code hash
QueueEmit click events asynchronously

Why

  • Cache: reads dominate and the mapping is immutable, so invalidation is trivial
  • CDN: cuts origin read QPS for viral links
  • Sharding: even distribution, no hot range
  • Queue: keeps the redirect path off the analytics write path

Previous

Design a URL Shortener: High-Level Architecture

Next

Design a URL Shortener: Deep Dive