Insights:Page Caching vs CDN Solutions: Trade-offs of 3 Approaches
Option 1: Browser Cache
Approach: Set Cache-Control and ETag for static assets, with versioning in filenames.
Advantages:
- Low cost, direct benefits.
- Reduces redundant downloads.
- Clearly effective for images, CSS, and JS.
Trade-offs:
- Cache HTML cautiously.
- Requires versioning or refresh after updates.
- User-side behavior cannot be fully controlled.
Best for: All websites, do first.
Option 2: Page Cache
Approach: Store generated HTML in a reverse proxy, application cache, or standalone cache layer.
Advantages:
- Reduces app and database computing load.
- Significantly lowers TTFB.
- Suitable for articles, sections, and product pages.
Trade-offs:
- Needs an invalidation mechanism.
- Login and personalized pages cannot be cached directly.
- Must be immediately refreshed after publishing.
Best for: Content sites, company websites, and pages with predictable update frequency.
Option 3: CDN Edge Cache
Approach: Place static assets and cacheable HTML on edge nodes.
Advantages:
- Shortens network distance.
- Offloads origin server pressure.
- Highly effective for cross-region access.
Trade-offs:
- Rules are complex; misconfiguration can cause content collisions.
- Pull from origin and purge operations require monitoring.
- Incurs ongoing costs.
Best for: Cross-region sites, image-heavy sites, and high-traffic sites.
Comparison Table
| Dimension | Browser Cache | Page Cache | CDN |
|---|---|---|---|
| What it primarily saves | Repeated downloads | Application compute | Network distance |
| Implementation cost | Low | Medium | Medium–high |
| Risks | Stale updates | Old pages / identity mix-up | Rule errors / full origin back-to-source |
| Best for | Static assets | Articles / sections | Cross-region / static assets |
| Rollout order | First | Next | Then |
Recommendations
- Start with browser caching.
- If the origin has compute bottlenecks, add page caching next.
- For cross-region traffic or bandwidth pressure, enable CDN after that.
- Every layer must have invalidation, monitoring, and rollback.
Things to Avoid
- Don't use CDN as a bandage for slow database queries.
- Don't cache login pages.
- Don't apply the same long TTL to both HTML and static assets.
- Don't deploy all three layers at once—you'll lose visibility into what caused any issue.
No single approach is universally better; the key is knowing where your bottleneck lives.
Related reading: