Topic 5.3
CDNs and Edge Filtering
In one line
CDNs use Bloom filters at edge nodes to avoid work: caching an object only on its second request (filtering out one-hit wonders, as Akamai described), checking whether content IDs exist before hitting origin, and shipping compact blocklists. Edge filters must be small, versioned and synchronised.
Think of it like this
A shop that only stocks an item after two different customers ask for it. The first request is noted on a small list; only a second request earns shelf space, so shelves aren't clogged with things nobody asks for twice.
Key ideas
- 01
One-hit wonders: a large share of objects are requested only once. Caching them evicts useful content. Akamai reported using a Bloom filter of recently seen URLs: cache an object only if the filter already has it (the second request), which cut disk writes substantially.
- 02
Origin shielding: an edge filter of valid content IDs (or known URLs) rejects requests for nonexistent objects before they reach origin, the CDN form of cache penetration protection.
- 03
Constraints at the edge: thousands of nodes, limited memory, no strong consistency. Filters are built centrally, versioned, and pushed (for example hourly), or rotated by time window (two filters: current and previous hour).
- 04
Staleness direction matters: a filter of "valid IDs" that misses new content causes false negatives (new content rejected), so new IDs must reach the edge before they're served, or the edge must fall back to origin on miss for recent IDs.
Code & diagrams
Interview problem
The problem
Bloom filter at the CDN edge
Design a Bloom-filter-based check at CDN edges that avoids caching one-hit wonders and rejects requests for nonexistent content IDs. Discuss false positives, edge memory, synchronisation and versioning.
Explain it without notes
What's a one-hit wonder and how does a Bloom filter help a CDN cache?
Practice
Size a seen-URL filter for an edge serving 200 million distinct URLs per day, rotating daily, at 1%.
Trade-offs
- ↔
Edge filters cut origin load and cache churn but must be kept fresh; staleness in the wrong direction rejects valid content.
Done when you can
I can design edge filters for one-hit wonders and origin protection with versioning.