Page Caching and CDN Explained in One Diagram

Page caching stores pre-rendered pages for faster delivery, while CDN distributes content across nodes closer to users. One reduces origin server load; the othe…

Insights:Page Caching and CDN Explained in One Diagram

Which Layers Does a Request Pass Through

When a user opens a page, it roughly goes through:

Browser Cache → DNS → CDN Edge Node → Origin / Reverse Proxy → Page Cache → Application → Database

If any layer hits the cache, subsequent layers don't need to repeat the work.

Browser Cache

The browser decides whether to re-download based on response headers:

  • Cache-Control:How long content can be cached and whether revalidation is needed.
  • ETag / Last-Modified:Whether the content has changed.
  • Expires:Legacy expiration time.

Static assets are suitable for long-term caching; HTML should be handled cautiously. Setting a very long cache for HTML may cause users to keep seeing outdated pages after updates.

Page Cache

Page cache stores "already-generated HTML." Common locations include:

  • Reverse proxy or web server.
  • Application-level cache.
  • Dedicated caching services.

Suitable for:

  • Pages that are essentially the same regardless of login status.
  • Articles, sections, or product pages with low update frequency.
  • Pages that can be explicitly invalidated.

Not suitable for:

  • Shopping carts, admin panels, and personalized recommendations.
  • Strongly real-time data.
  • Pages that vary by user identity.

CDN Edge Cache

CDN places static assets and cacheable HTML at edge nodes. Users visit the edge first, and if there's a hit, the content is returned directly without going back to the origin.

Key configurations:

  • Which paths to cache and for how long.
  • Which cookies or query parameters affect caching.
  • Origin fallback ratio and origin bandwidth.
  • Cache invalidation methods and propagation time.

CDN is not "set it and forget it." Misconfigured cache rules can cache login states, prices, or stale pages for all visitors.

How the Three Layers Work Together

Layer Primary Purpose Typical Targets
Browser Cache Avoid re-downloading on repeat visits Images, CSS, JS, fonts
Page Cache Reduce application and database load Article pages, category pages
CDN Shorten network distance and ease origin server load Static assets, cacheable HTML

Diagnostic Sequence

  1. Check TTFB first to confirm whether the bottleneck is the origin or the network.
  2. Apply browser caching and CDN to static assets first.
  3. Evaluate page caching for dynamic pages next.
  4. Handle authenticated or personalized pages last.
  5. Change only one layer at a time and keep rollback options ready.

What Not to Do

  • Don't set long-cache headers on all HTML.
  • Don't cache user-specific content.
  • Don't enable CDN and then ignore cache invalidation.
  • Don't use CDN to mask slow origin queries.

The goal of caching isn't "maximum hit rate"—it's "right things cached, right things refreshed."

Related Reading:

  • Core Web Vitals Measurement: How Field Data, Lab Data, and CrUX Work Together
  • What Are Core Web Vitals? A Visual Explanation
  • Tech Practice