A practical CDN and edge caching playbook for sub-100ms TTFB
How we layer DNS, TLS, cache hierarchies, and stale-while-revalidate so global users see consistent performance without sacrificing freshness.
We start by measuring real user paths: TTFB, LCP, and origin load—not synthetic lab scores alone.
Cache key design is where most teams leak performance. We normalize keys on device class and geography only when personalization truly requires it; otherwise we push variance to the client with small JSON blobs.
Stale-while-revalidate at the edge lets marketing deploy hero copy without waiting for a full origin purge. We pair that with short max-age for HTML shells and long TTL for hashed static assets.
Origin shielding and collapse-forward requests reduce thundering herds during traffic spikes. For API-heavy pages we prefer BFF-level caching with explicit invalidation hooks instead of blindly caching JSON at the edge.
The outcome for a recent enterprise rollout: median TTFB dropped from 420ms to 78ms globally, while editorial teams kept same-day publish workflows.