HomeMethod

Knowledge

Web VitalsTechniquesSnippetsAnswersImpactsBottlenecks

Excessive cache invalidation

  • Caching

Problem Summary

Excessive cache invalidation defeats the purpose of caching by clearing the cache too often. Each invalidation forces regeneration from the origin, eliminating performance benefits.

Performance Impact

  • Low cache hit ratio: Cache rarely serves content
  • Constant regeneration: Origin generates same content repeatedly
  • No performance benefit: Effectively no caching
  • Increased server load: More origin requests

How to Detect

  1. CDN dashboard: Very low cache hit ratio
  2. Server logs: High cache purge frequency
  3. Monitoring: Cache invalidation alerts

Solutions

1. Set Appropriate Purge Rules

Only purge when content actually changes.

2. Use Stale-While-Revalidate

Code
Cache-Control: public, max-age=3600, stale-while-revalidate=86400

3. Smart Purging

Purge specific URLs, not entire cache.

4. Increase Cache TTL

Longer cache duration between invalidations.

Further Reading

Support our family now