SysPad › Examples › URL shortener

URL shortener

A compact read-heavy service: CDN, API, a hot-links cache, a key-value store, and a click-analytics stream.

A simple read-heavy path - a gentle first example.

CDN CloudFront Load Balancer ALB Shortener API Fargate AT LIMIT Hot Links ElastiCache Links Table DynamoDB Click Stream Kinesis

How it works

CDN
Even a redirect is cacheable. Seven in ten requests are answered at the edge and never reach the API at all.
Hot Links
A small number of links take most of the traffic, so a 95% hit rate is realistic here. Every hit is a lookup the links table never sees.
Links Table
Reads outnumber writes roughly ten to one: creating a link is rare, following one is constant. That ratio is what makes the whole design cheap.
Click Stream
Click analytics is fire-and-forget. The redirect is already travelling back to the browser while this write is still in flight.

Lessons for this architecture

Worked step by step

The same interview question, built up one twist at a time, with a simulation at each stage.

Other reference architectures

Open this architecture in SysPad · All examples