Skip to content

Case study: URL shortener

Design a URL shortener end to end: code generation without collisions, a cache-carried redirect path, and what happens when the cache or the database fails.

35 min9 steps

By the end you can
  • Estimate write rate, read rate, storage and the code length a shortener needs
  • Choose a code-generation scheme and justify it with collision and enumerability arguments
  • Design a redirect path whose load the cache carries, and predict database load from the hit rate
  • Predict how the design behaves when the cache restarts or the database leader fails

Pin down what you are building

Create, redirect, delete links

  • Custom aliases; expiry; ownership

Read-heavy

  • Durable acknowledged links; bounded redirect latency; abuse controls

Which clarifying question changes the design the most?

Answer this step to continue.