Skip to content
Performance & Accessibility

Edge Caching for Dynamic Pages: What Actually Works

Caching pages at content delivery network edges even when they contain some personalized or changing content.

Marcus Adeyemi Technical Director 2 min read 21 views
Edge Caching for Dynamic Pages: What Actually Works

Why does it matter?

Edge caching turns slow dynamic pages into fast ones, but only with careful rules about what varies per visitor.

What are the numbers?

  • Cache keys determine what counts as the same page
  • Vary headers tell caches which request headers change the response
  • Purging content changes require cache invalidation
  • Personalization user-specific fragments can be loaded separately

What should I do?

  1. Cache the shared page and load personal parts separately
  2. Define cache keys deliberately
  3. Set up purge hooks on content changes
  4. Watch for cookies that break caching
  5. Measure cache hit rates
What to do and what to avoid with edge caching for dynamic pages, side by side
Good practice against the usual mistakes, from the sources listed below.

What should I avoid?

Avoid:

  • Caching pages containing another user's data
  • Cookies that vary every response
  • Manual purging only
  • Long cache lifetimes with no invalidation

When should I get help?

Short answer Bring in help when dynamic sites need to survive traffic spikes.

Where this comes from

The figures and practices above come from the sources listed.

Working on something like this?

We take on Performance & Accessibility work for teams who want it done once, properly. Tell us what you are building and we will tell you honestly whether we are the right studio for it. Start a project.

Where to go next

Spotted something wrong? Report an error on this page. We correct on the page and say what changed.

All services

The work behind this article, and what it costs.

Marcus Adeyemi

Builds and maintains the web work. Writes about front-end architecture, performance, accessibility and the unglamorous parts of keeping a site alive.

Keep reading

More in Performance & Accessibility