<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/i-added-a-cdn-cache-to-my-site-and-it-got-slower-here-s-the-math-i-should-have-done-first--exb0mzxjn" -->

---
title: I Added a CDN Cache to My Site and It Got Slower. Here's...
description: Adding a Cloudflare CDN cache to a low-traffic static Astro site made an independent crawler's slow-page count nearly double, from 38 to 75. The root issue: a...
canonical: https://daily.dev/posts/i-added-a-cdn-cache-to-my-site-and-it-got-slower-here-s-the-math-i-should-have-done-first--exb0mzxjn
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: I Added a CDN Cache to My Site and It Got Slower. Here's the Math I Should Have Done First. | daily.dev
og:description: Adding a Cloudflare CDN cache to a low-traffic static Astro site made an independent crawler's slow-page count nearly double, from 38 to 75. The root issue: a...
og:url: https://daily.dev/posts/i-added-a-cdn-cache-to-my-site-and-it-got-slower-here-s-the-math-i-should-have-done-first--exb0mzxjn
og:image: https://api.daily.dev/og/posts/EXb0mZxJn.png
og:image:alt: I Added a CDN Cache to My Site and It Got Slower. Here's the Math I Should Have Done First.
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# I Added a CDN Cache to My Site and It Got Slower. Here's the Math I Should Have Done First.

**[freeCodeCamp](https://daily.dev/sources/freecodecamp)** · 9 min read · 2 upvotes · 0 comments

## Summary

Adding a Cloudflare CDN cache to a low-traffic static Astro site made an independent crawler's slow-page count nearly double, from 38 to 75. The root issue: a cache MISS costs roughly 85ms more than serving with no cache at all, because the CDN has to store the object while streaming it. Crawlers and first-time visitors always hit cold, so with only ~35 daily HTML requests spread across 77 pages and global edge locations, the realistic hit rate was near zero when a 67% hit rate was needed to break even. The fix was reverted the same day. A break-even formula is derived, h > (M − B) / (M − H), for deciding whether caching will help before deploying it, along with scripts to verify a CDN cache is actually serving updated content after a purge rather than trusting a purge API's success response.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.freecodecamp.org/news/cdn-cache-made-my-site-slower>

## Questions this post answers

### Why did enabling Cloudflare edge caching for HTML make my site slower according to an external crawler?

Because a cache miss costs more than serving the page uncached. On this static site, a cold cache miss took 0.366s versus 0.281s straight to origin, an ~85ms penalty from the CDN having to store the object while streaming it. Since crawlers and first-time visitors always hit cold, and the site had near-zero repeat traffic, nearly every request paid that penalty instead of benefiting from a hit.

_Test cache rollouts against real traffic patterns before shipping, since daily.dev readers often trade CDN war stories._

### How do I calculate the minimum cache hit rate needed for a CDN to actually improve performance?

Use the formula h > (M − B) / (M − H), where M is cache-miss time, B is your no-cache baseline, and H is cache-hit time. In one measured case, M was 0.366s, B was 0.281s, and H was 0.239s, giving a required hit rate above 67% just to break even; a low-traffic site with 77 pages and about 9 visitors a day realistically had a hit rate near zero.

_Run this break-even math before flipping on edge caching so daily.dev readers don't ship a regression._

### How can I verify that a Cloudflare cache purge actually cleared stale HTML instead of trusting the purge API response?

Compare the SHA-256 hash of the locally built HTML file against the hash of the live page fetched over HTTPS, since a purge API returning success:true is not proof anything was actually cleared. If the hashes differ, the edge is stale and the deploy isn't live; if they never match, suspect an edge feature rewriting HTML, like script optimizers or auto-minification, rather than the cache itself.

_Bake hash verification into deploy pipelines so daily.dev-following teams catch silent stale-cache failures early._

## Similar posts on daily.dev

- [Why we're rethinking cache for the AI era](https://daily.dev/posts/why-we-re-rethinking-cache-for-the-ai-era-rurzfxjxt) · Cloudflare · 2 upvotes · 0 comments
- [Cloudflare and ETH Zurich Outline Approaches for AI-Driven Cache Optimization](https://daily.dev/posts/cloudflare-and-eth-zurich-outline-approaches-for-ai-driven-cache-optimization-lxzhdy1ou) · InfoQ · 0 upvotes · 0 comments
- [WordPress Speed Optimization Explained Layer by Layer](https://daily.dev/posts/wordpress-speed-optimization-explained-layer-by-layer-h540rtuzr) · ACF · 9 upvotes · 1 comments
- [My blog got popular, and my bandwidth exploded to ~300GB in just 10 days](https://daily.dev/posts/my-blog-got-popular-and-my-bandwidth-exploded-to-300gb-in-just-10-days-nflugkjyl) · Neciu Dan · 1 upvotes · 0 comments
- [Crazy Fast Website](https://daily.dev/posts/crazy-fast-website-f0or2yinu) · Hacker News · 3 upvotes · 0 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#cloudflare](https://daily.dev/tags/cloudflare)

[View this post on daily.dev](https://daily.dev/posts/i-added-a-cdn-cache-to-my-site-and-it-got-slower-here-s-the-math-i-should-have-done-first--exb0mzxjn)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"I Added a CDN Cache to My Site and It Got Slower. Here's the Math I Should Have Done First.","url":"https://daily.dev/posts/i-added-a-cdn-cache-to-my-site-and-it-got-slower-here-s-the-math-i-should-have-done-first--exb0mzxjn","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/i-added-a-cdn-cache-to-my-site-and-it-got-slower-here-s-the-math-i-should-have-done-first--exb0mzxjn"},"datePublished":"2026-08-27T22:50:36.293Z","dateModified":"2026-09-14T06:32:41.535Z","description":"Adding a Cloudflare CDN cache to a low-traffic static Astro site made an independent crawler's slow-page count nearly double, from 38 to 75. The root issue: a...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/2f07d724c4127402b799acaf44d2d63d?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/2f07d724c4127402b799acaf44d2d63d?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"freeCodeCamp","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"freeCodeCamp","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1628412854/logos/freecodecamp","url":"https://daily.dev/sources/freecodecamp"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/i-added-a-cdn-cache-to-my-site-and-it-got-slower-here-s-the-math-i-should-have-done-first--exb0mzxjn","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"webdev,cloudflare","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"freeCodeCamp","item":"https://daily.dev/sources/freecodecamp"},{"@type":"ListItem","position":3,"name":"I Added a CDN Cache to My Site and It Got Slower. Here's the Math I Should Have Done First."}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/i-added-a-cdn-cache-to-my-site-and-it-got-slower-here-s-the-math-i-should-have-done-first--exb0mzxjn#faq","mainEntity":[{"@type":"Question","name":"Why did enabling Cloudflare edge caching for HTML make my site slower according to an external crawler?","acceptedAnswer":{"@type":"Answer","text":"Because a cache miss costs more than serving the page uncached. On this static site, a cold cache miss took 0.366s versus 0.281s straight to origin, an ~85ms penalty from the CDN having to store the object while streaming it. Since crawlers and first-time visitors always hit cold, and the site had near-zero repeat traffic, nearly every request paid that penalty instead of benefiting from a hit. Test cache rollouts against real traffic patterns before shipping, since daily.dev readers often trade CDN war stories."}},{"@type":"Question","name":"How do I calculate the minimum cache hit rate needed for a CDN to actually improve performance?","acceptedAnswer":{"@type":"Answer","text":"Use the formula h \u003e (M − B) / (M − H), where M is cache-miss time, B is your no-cache baseline, and H is cache-hit time. In one measured case, M was 0.366s, B was 0.281s, and H was 0.239s, giving a required hit rate above 67% just to break even; a low-traffic site with 77 pages and about 9 visitors a day realistically had a hit rate near zero. Run this break-even math before flipping on edge caching so daily.dev readers don't ship a regression."}},{"@type":"Question","name":"How can I verify that a Cloudflare cache purge actually cleared stale HTML instead of trusting the purge API response?","acceptedAnswer":{"@type":"Answer","text":"Compare the SHA-256 hash of the locally built HTML file against the hash of the live page fetched over HTTPS, since a purge API returning success:true is not proof anything was actually cleared. If the hashes differ, the edge is stale and the deploy isn't live; if they never match, suspect an edge feature rewriting HTML, like script optimizers or auto-minification, rather than the cache itself. Bake hash verification into deploy pipelines so daily.dev-following teams catch silent stale-cache failures early."}}]}
```

