Design: a URL shortener at scale

The core idea

A URL shortener can reuse the destination of a popular link instead of looking it up in the database for every request.

A shared cache makes that copy available to several application instances.

In this lesson

  • Preserve the product before adding components
  • Share copies, keep one durable owner
  • Cache the fields the handler needs
  • Choose the copy's cost and lifetime
  • Compare the work, request by request
  • A warm hit can still fail
  • Bound the work when the cache cannot help
  • Make creation and the first read agree
  • Keep the edge within the same agreement
  • The next measurement

Continue reading

Pro unlocks video lessons, visual walkthroughs, full notes, diagrams, case studies, and implementations across the System Design archive.