Engineering

How we scaled ZipZy short links to 50M redirects a month

A look at the caching, database, and edge-routing decisions behind ZipZy's redirect layer — and the mistakes we made along the way.

ZipZy TeamZipZy Team··1 min read

Updated January 22, 2026

How we scaled ZipZy short links to 50M redirects a month
Share

Every short link is a promise: tap it, and you land where you expect, instantly. Keeping that promise at scale is harder than it looks. Here's how the ZipZy redirect layer evolved.

The naive first version

Our first redirect handler did exactly one thing: look up a slug in MySQL, then issue a 302. It worked beautifully — until it didn't.

The database is not a cache. Treating it like one is the fastest way to page yourself at 3am.

Adding an edge cache

We moved hot slugs into an in-memory layer and let the edge do the heavy lifting.

Tip

Cache the resolution, not the request. A slug maps to a destination; that mapping rarely changes, so it caches almost perfectly.

Here's the simplified lookup:

resolve.ts
async function resolve(slug: string): Promise<string | null> {
  const cached = await edge.get(slug);
  if (cached) return cached;
 
  const row = await db.query("SELECT dest FROM links WHERE slug = ? LIMIT 1", [slug]);
  if (!row) return null;
 
  await edge.set(slug, row.dest, { ttl: 3600 });
  return row.dest;
}

What we measured

Layerp50p99Hit rate
MySQL only42 ms180 ms—
+ memory cache3 ms22 ms94%
+ edge cache0.8 ms6 ms99.2%

The checklist we now follow

  • Cache resolutions at the edge
  • Set a sane TTL and invalidate on edit
  • Keep the DB path fast for the 1% miss
  • Move analytics writes fully async (in progress)

Small, boring decisions compound. That's the whole trick.1

Footnotes

  1. We revisit these numbers quarterly. Your traffic shape will differ. ↩

ZipZy Team

Written by

ZipZy Team

Aarav leads infrastructure at ZipZy and has a soft spot for boring, reliable systems.

Related articles

A Beginner's Guide to Campaign Tracking
MarketingJuly 26, 2026· 4 min read

A Beginner's Guide to Campaign Tracking

Learn campaign tracking end to end—UTMs, trackable links, analytics, and attribution—so you can finally see which marketing efforts actually drive results.

ZipZy TeamZipZy Team