Insights:Page Cache and CDN Mistakes: These 6 Settings Hurt Performance the Most
Mistake 1: Setting Long Cache for All HTML
After an article is updated, users keep seeing the old page; after publishing new content, the homepage remains unchanged.
Fix: Use short cache or negotiation (conditional) cache for HTML; only static assets should use long cache.
Mistake 2: Caching Content with Login State
Caching user A's page for user B causes account mix-ups, wrong prices, and incorrect permissions.
Fix: Differentiate cache keys by Cookie or identity; do not cache admin panels, shopping carts, or payment pages.
Mistake 3: Ignoring Query Parameters
?page=2, ?utm=..., ?id=... are treated as the same page, leading to messy content or cache pollution.
Fix: Clarify which parameters affect content and which can be ignored; don't indiscriminately ignore all parameters.
Mistake 4: TTL Too Long Without a Refresh Mechanism
After prices, stock, or promo pages update, the CDN continues serving stale content.
Fix: Set reasonable TTLs, purge by URL or tag after publishing, and keep a manual origin-fetch option.
Mistake 5: Conflicting Cache Rules Between Origin and CDN
The origin says cache for 1 hour, the CDN says 1 day; or the origin prohibits caching while the CDN forces it.
Fix: Put origin and CDN cache headers, TTLs, and purge rules in one table and align them item by item.
Mistake 6: No Rate Limiting on Origin Requests
When the CDN cache invalidates or gets attacked, all requests fall back to the origin, overwhelming it.
Fix: Set origin-concurrency limits, prewarm hot items, and implement origin-side rate limiting; monitor the origin ratio and 5xx errors.
Troubleshooting Order
- Check response headers:
cache-control,age,x-cache. - Compare content returned by the origin and the CDN.
- Inspect cache keys and Cookies.
- Inspect purge settings and TTL.
- Inspect origin calls and origin load.
In One Sentence
The goal of cache configuration isn't to achieve the highest hit rate, but rather to ensure content accuracy, timely updates, and no overload on the origin server.
Related reading: