How to solve the problem of low cache hit rate in CDN?
Introduction
You set up a CDN. You configured cache rules. You expected origin load to drop and page speed to improve. Then you checked the cache hit rate, and it is lower than you hoped. Maybe much lower.
A low cache hit rate means many requests still reach the origin, which defeats part of the purpose of using a CDN. The good news is that low hit rate usually has a handful of common causes, and most of them are fixable without rebuilding your entire setup.
This article walks through how to diagnose a low CDN cache hit rate and what to fix first. It assumes you already understand basic CDN caching and want to improve what you have.
What Counts as a Low Cache Hit Rate
There is no universal “good” number. It depends on your content.
A site that is mostly static images, CSS, and JS should see a high hit rate, often above 90%.
A site with heavy dynamic content, APIs, and personalized pages will naturally have a lower hit rate.
A site with a mix of both may sit somewhere in the middle.
The useful question is not “is my hit rate high enough” but “are the resources that should be cached actually being cached.” If static assets are missing the cache, that is a problem. If personalized API responses are not cached, that is correct behavior.
Diagnose Before You Fix
Before changing anything, gather data.
Break down hit rate by resource type. Images, CSS, JS, HTML, and API responses should not share one number. Check them separately.
Check hit rate by path or directory.
/static/,/images/,/api/, and/may behave very differently.Look at cache miss reasons. Many CDNs report why a request missed: not cached, expired, purged, or bypassed.
Compare over time. A sudden drop may be caused by a deployment, a config change, or a traffic pattern shift.
Check origin request volume. If origin requests are rising while traffic is flat, caching is not doing its job.
Once you know which resources are missing the cache and why, the fix is usually obvious.
Cause 1: Cache Rules Do Not Match the Request
The most common reason for a low hit rate is simple: the cache rule does not match the actual request.
Examples:
The rule caches
/images/*but the site serves images from/assets/images/*.The rule matches by file extension, but the URL has a query string that changes the match.
The rule is set on one domain, but the site serves assets from a CDN subdomain with a different path.
Check the actual request URLs in your logs or browser dev tools. Compare them to your cache rules. Adjust the rule to match reality, not the other way around.
Cause 2: Query Strings and URL Parameters Break the Cache
Many CDNs treat every unique URL, including query strings, as a separate cache entry.
If your site appends tracking parameters, session IDs, or version strings to every request, the cache may see thousands of unique URLs for the same file. Each one is a separate miss.
Fixes include:
Configure the CDN to ignore irrelevant query parameters for static assets.
Use a consistent version parameter instead of random ones.
Avoid appending session IDs to static resource URLs.
Check your CDN documentation for query string handling options. Most support “ignore all,” “ignore specific,” or “use all” modes.
Cause 3: TTL Is Too Short
TTL controls how long a resource stays in cache. If TTL is too short, resources expire before they can be reused.
Common signs:
Hit rate is low but rises during high-traffic periods.
Static assets miss the cache even though they rarely change.
Origin sees repeated requests for the same files.
Fix: increase TTL for resources that do not change often. Use versioned file names or query parameters to handle updates, so you do not need a short TTL for cache busting.
Cause 4: Origin Cache-Control Headers Conflict with CDN Rules
Your origin server can send Cache-Control headers that override or conflict with CDN cache rules.
Examples:
Origin sends
Cache-Control: no-cacheorprivate, preventing CDN caching.Origin sends a short
max-agethat overrides a longer CDN TTL.Origin sends
Set-Cookieon static assets, which some CDNs treat as uncacheable.
Check the response headers for your static assets. If the origin is telling the CDN not to cache, the CDN will obey. Fix the origin headers or configure the CDN to override them where appropriate.
Cause 5: Cache Purge Is Too Aggressive
If you purge the whole site every time you update one file, you force everything to re-fetch. Hit rate drops, origin load spikes, and it takes time to rebuild the cache.
Better purge strategies:
Purge by URL for individual files.
Purge by directory or wildcard for groups of related files.
Use versioned filenames so you do not need to purge at all for routine updates.
Reserve full-site purge for major redesigns or mass updates.
Cause 6: Dynamic Content Is Being Cached Incorrectly, or Not at All
Dynamic content is a tricky area. If you cache it too aggressively, users see stale or wrong data. If you do not cache it at all, origin load stays high.
The right approach is to classify dynamic content:
Cacheable with short TTL: public API responses, search results that do not change per user.
Cacheable with variation: content that varies by device, language, or region.
Not cacheable: login states, personalized data, real-time transactions.
If your hit rate is low because most of your traffic is dynamic, that may be expected. The goal is not to cache everything, but to cache what is safe and useful.
Cause 7: Traffic Is Too Diverse or Too Spread Out
A CDN caches per node. If your traffic is spread across many regions and each region only sees a few requests for each resource, nodes may not build up a useful cache.
This is common for sites with a global but low-traffic audience.
Options:
Accept a lower hit rate and focus on latency improvement instead.
Use fewer, larger nodes in key regions.
Combine CDN caching with origin optimization so misses are cheaper.
What to Fix First
If you are not sure where to start, you can follow this order:
Check cache rules against actual request URLs. This is the most common and easiest fix.
Check query string handling. Ignore irrelevant parameters for static assets.
Check origin Cache-Control headers. Make sure the origin is not blocking caching.
Increase TTL for stable resources. Use versioning for updates.
Review purge strategy. Stop purging the whole site for small changes.
Classify dynamic content. Cache what is safe, leave the rest.
Re-measure hit rate by resource type and path. Confirm the fix worked.
Final Thoughts
A low CDN cache hit rate is usually not a sign that the CDN is broken. It is a sign that the cache rules, origin headers, purge strategy, or content classification need attention.
Diagnose by resource type and path. Check the actual request URLs. Look at origin headers. Fix the most common causes first. In most cases, the hit rate improves without a major rebuild.
In the next article, I will share some experience with dynamic content and CDN caching. If you are interested, keep an eye out.
Thank you very much for reading to the end!
