
Overview
A production URL shortener with click analytics. The interesting part isn't shortening a URL — it's doing the redirect fast enough that nobody notices the hop.
The Problem
A redirect service lives or dies on latency: every millisecond sits directly in a user's navigation path, and cold database lookups on the hot path are unacceptable.
The Solution
Redis-backed lookup on the redirect path with the database as source of truth — reads hit cache, writes and analytics happen off the critical path.
Architecture
- Redis cache-aside on the redirect hot path; persistent store behind it.
- Async analytics recording so click tracking never delays the redirect.
Key Features
- Instant short-link creation with custom aliases
- Click analytics per link
- QR code generation
Challenges
Analytics without latency
Recording a click before redirecting adds user-visible delay. Analytics writes were made fire-and-forget with periodic reconciliation, keeping redirects at cache speed.
Performance
- Cache-hit redirects respond in single-digit milliseconds server-side.
Lessons Learned
Small systems are the best place to practice hot-path thinking — the constraints are real but the blast radius is yours.
Next case study
Tic-Tac-Toe Online