Over thirty-two days a site we look after served 386,759 requests. 5.1% of them came from the edge cache. Counting only true cache hits, 2.3%.
This is our own configuration. It is worth writing down for that reason.
What was in place
Not nothing. The full arrangement, all of it working as designed:
- A CDN in front of the origin, terminating TLS and absorbing the attack traffic
- Automatic edge purging wired into the CMS, so publishing a page clears it
- Purge extended to the pages a post appears on — the blog index, the site roots — because a published article also shows as a card on a listing that would otherwise stay stale
- A deploy step that purges everything, then re-fetches every live page in order and reports the cache status of each one
- Redis on two databases, one of them reserved for resized images
- A five-minute page cache inside the application
None of that is decorative. Every piece was written deliberately, and one of them exists because of a bug worth its own paragraph: the purge configuration takes a key spelled ZONEID. Spelling it ZONE_ID raises an error inside the background task, which the task runner swallows. Every purge silently did nothing, and everything looked fine. That is now pinned by a test.
So: careful work, real thought, a documented scar. And a 5.1% hit rate.
The answer was one setting nobody had set
HTML was coming back marked dynamic. That is the CDN’s word for “not eligible for caching, sent to the origin.”
Content delivery networks do not cache HTML by default. They cache things that look like static files — images, stylesheets, scripts, fonts — matched by extension. HTML is assumed to be personalized, because for a great many sites it is: a logged-in header, a cart count, a name in the corner. Caching it by default would show one visitor another visitor’s page.
So HTML is opt-in, and opting in is a rule you write on the CDN, not code you deploy. Nobody had written it. Twenty-two percent of all requests were HTML going to the origin every single time, past a cache that was ready to hold it and had been told nothing.
The purge infrastructure — the thing that had been carefully built — exists precisely to make that setting safe. It was the machinery for a door that was never opened.
The second number, which is worse
A quarter of the traffic was the site measuring itself.
Roughly 4,800 requests a day, 26% of everything, were the analytics beacon the CDN fires from the browser on page load. That is not fraud and not a fault. It is telemetry doing its job.
It matters because of what people do with the requests-per-day figure. On one day that number read 14,353. The number of requests that were anything other than the site reporting on itself was about 9,500. Every capacity argument, every “we’re growing” reading, every cost projection built on the headline starts a quarter high.
Configuring a cache is not verifying one
That is the whole lesson and it generalizes past caching.
The failure here was not ignorance or laziness. Every individual decision was sound. What was missing was the step after the work: going to the thing and asking it what it actually did. The deploy script even prints the cache status of every page it warms — the evidence was being generated on every deploy and read by nobody.
This is the ordinary shape of infrastructure problems. Not a wrong choice, but a correct choice whose effect was never confirmed, sitting quietly behind a dashboard that was never opened because nothing was on fire.
Three things to check on your own site
- Find your cache hit rate. Your CDN shows it on the front page of its analytics. If you have no idea what it is, that is the finding, and it takes a minute to fix that.
- Check whether your HTML is being cached at all. Load a page twice and look at the cache-status header in your browser’s network tab.
DYNAMICorBYPASSon the second load means every visitor is reaching your server. - Work out what share of your traffic is you. Analytics beacons, uptime monitors, health checks and your own deploy scripts all show up in the request count. Subtract them before you quote the number to anybody.
None of this needs a rebuild. It needed somebody to look.
If you want the version where somebody does look, that is what an audit is, and it is a fixed price over five days. Tell us what you are running — the reply is free, and it will say if there is nothing here worth paying for.