Design Content Delivery Network

Hard45 min
1 / 30
understanding7 min read

Problem Statement and Global CDN Context

Problem Statement and Global CDN Context — CDN system design interview section.

Problem Statement and Global CDN Context

Design a multi-tenant CDN that terminates TLS at the edge, caches static and streaming objects, and shields customer origins from flash crowds.

Key points

  • Cloudflare/Akamai/Fastly interviews expect control-plane vs data-plane separation.
  • Success metrics: cache hit ratio, p95 TTFB on hits, purge propagation SLA, origin offload percentage.
  • Scale anchor: 50M RPS global, 300+ PoPs, 25 Tbps peak egress, 92% hit ratio baseline.

Deep dive

A CDN is not a load balancer with cache headers—it is a distributed storage and routing fabric. Clients reach the nearest healthy PoP via Anycast or GeoDNS; edge proxies consult a local index before fetching from shield or origin. Purge and certificate changes ride an async control bus; the hot path never blocks on Postgres.

Failure and degradation

If a PoP loses uplink, withdraw Anycast prefix after warming neighbors. If origin returns 503, serve stale-if-error within policy window. If purge bus lags, rely on versioned URLs for deploy safety while ops clears backlog.

Cost lens

Egress TB dominates COGS—improve hit ratio by 1% at 25 Tbps saves massive monthly spend. Shield RAM is cheaper than origin egress; spend memory to buy origin protection.

Security lens

Terminate TLS at edge with rotated keys, enforce tenant isolation on cache keys, rate-limit purge APIs, and sign URLs for hot objects. WAF optional module blocks obvious L7 abuse before cache lookup.

javaOne Dark Pro
1public final class CacheKey {
2 private final String tenantId;
3 private final String assetPath;
4 private final String variant;
5 public String normalized() {
6 return tenantId + ":" + variant + ":" + assetPath.toLowerCase(Locale.ROOT);
7 }
8}
pythonOne Dark Pro
1from dataclasses import dataclass
2
3@dataclass(frozen=True)
4class EdgeRequest:
5 cache_key: str
6 client_asn: int
7 colo: str
typescriptOne Dark Pro
1interface SignedUrl {
2 assetId: string;
3 expiresAtEpochSec: number;
4 signature: string;
5}
6
7export function isExpired(url: SignedUrl, nowSec: number): boolean {
8 return nowSec >= url.expiresAtEpochSec;
9}

Why interviewers care

Content Delivery Network interviews reward crisp scope, explicit trade-offs, and failure stories—not generic microservice diagrams.

Interview checkpoint

Name one failure story for Problem Statement and Global CDN Context that proves you understand real outages, not happy-path diagrams.

Key Highlights

  • Cloudflare/Akamai/Fastly interviews expect control-plane vs data-plane separatio
  • Success metrics: cache hit ratio, p95 TTFB on hits, purge propagation SLA, origi
  • Scale anchor: 50M RPS global, 300+ PoPs, 25 Tbps peak egress, 92% hit ratio base
Say this clearly
We never put ranking inference on the synchronous play path—manifest fetch stays O(1) keyed by titleId + profile region.
Avoid
Treating Netflix like YouTube UGC—studio masters, windowed licensing, and device DRM contracts dominate the design.

Section Rescue Kit

Buzzwords to use:

AnycastSurrogate-Key

Safe statements:

  • "I separate control plane config from data plane cache lookup—hot path stays microseconds."
  • "Purges are versioned per tenant; I never rely on a single global flush."
  • "Bytes live in object storage and edge SSD tiers, not in OLTP rows."
Design Content Delivery Network - System Design | WinJob | WinJob