All examples

Examples

How a URL shortener handles a billion clicks

A short link resolved through an API and a database, then a cache for popular links, a load balancer over two APIs, and one API failing while the traffic moves to the other.

This video was made with the System design skill.

  • 1:11
  • System design
  • Narrated by Charon
  • English

Made from a prompt

How does a URL shortener handle a billion clicks? Show the read path, a cache, and scaling out.

Video transcript

A billion clicks a day: your short links must redirect without overwhelming storage.

Your browser calls an API. The API reads the destination from a database, then returns a redirect.

That averages over eleven thousand requests per second. Here, database lookups take eighty milliseconds. Storage becomes the bottleneck.

Add a cache for popular links. On a miss, read the database, then cache the destination.

Cache hits take two milliseconds here, skipping storage. Expire entries and invalidate changed links; cached destinations can become stale.

Add a load balancer, then another stateless API. Both share storage. Extra servers cost more.

What if one API fails? Health checks remove it; traffic moves to the survivor. Keep spare capacity.

Browsers request redirects. The balancer distributes clicks, APIs resolve links, the cache skips reads, and the database keeps mappings.

Your topic, drawn in about a minute.

Your first 2 videos are free, up to 1 minute each, watermarked. No card required. Full product, every voice and style included.