This article explains how a CDN (content delivery network) actually stores your files, for anyone who has turned one on and still sees more traffic at the origin server than expected. A CDN is a set of data centres called POPs (points of presence), often hundreds of them, and each POP keeps its own separate cache. A visitor’s request goes to a nearby POP, so a file that is popular in Montréal may still be missing from the cache in Frankfurt. With hundreds of separate caches, a file that few people ask for misses far more often than if it lived in one place. The usual fix is tiered caching or an origin shield, which make the edge POPs ask a central cache first instead of your server.
How to verify
Check which POP your test traffic is hitting, what the cache status is, and whether origin sees a shield or all the POPs directly.
curl -sI https://app.example.com/test.css | grep -iE 'cf-ray|x-amz-cf-pop|x-served-by|x-cache|cf-cache-status|age'
# Cloudflare: cf-ray includes the POP code (e.g. YYZ for Toronto)
# Fastly: x-served-by lists the POP cache chain
# CloudFront: x-amz-cf-pop has the POP id
# On origin, count distinct source IPs in your access log
awk '{print $1}' /var/log/nginx/access.log.1 | sort -u | wc -l
awk '{print $1}' /var/log/nginx/access.log.1 | sort | uniq -c | sort -rn | head
If origin sees thousands of distinct CDN IPs (one per POP), you have no shield. If origin sees a few dozen IPs concentrated in a small number, a shield/regional tier is in front.
What’s happening
A CDN POP is a cache server (or a cluster) sitting in a network-favourable location. Traffic reaches the nearest POP via anycast — the same IP is announced from every POP, and BGP picks the shortest path. The user does not know which POP they hit; their POP is whichever was “closest” in BGP terms at that moment.
Each POP has its own cache. By default, a request that misses in POP A goes directly to origin. If POP B serves an identical request a second later, it goes to origin too — the two POPs do not share cache. With 200 POPs, an unpopular object can produce 200 origin requests before any POP has a hit.
Tiered caching solves this. The CDN designates one or a few POPs as a regional tier; edge POPs first check the regional tier and only fall through to origin if the regional tier misses too. Origin shielding is the same idea applied at a single chosen POP — all origin requests funnel through one POP that absorbs the deduplication. The effect on origin load is dramatic for objects with long-tail demand.
The trade-off: tiered cache adds a hop, which adds latency on cold paths. For hot objects served from the edge POP directly, nothing changes. For warm objects served from the regional tier, you add ~10-30 ms. For cold objects, you add the same hop but save a lot on origin egress and CPU.
The decision
-
Anycast routing is automatic. You do not configure it; the CDN’s BGP does it. What you do control is whether the CDN routes by geo-proximity, latency, or load — the dashboards of the major CDNs let you bias the choice.
-
Enable tiered caching for any non-trivial origin. Cloudflare calls it Argo Tiered Cache, Fastly calls it shielding (selecting a single POP), CloudFront uses regional edge caches by default. The default is usually “off” — you turn it on per zone.
# Cloudflare: Argo > Tiered Caching > "Smart Tiered Cache Topology" # Fastly: Service > Origins > select shield POP (e.g. lcy-uk for London) # CloudFront: Behaviors > Origin > "Origin Shield" > Choose region -
Pick the shield region with intent. It should be geographically close to origin (to keep the shield-to-origin RTT small) and have enough capacity to absorb your peak. Picking the wrong shield region adds latency to every cache miss.
-
Measure the hit rate at every tier. A 95 % POP hit rate sounds good, but if the remaining 5 % all go directly to origin (no shield), origin still sees a lot of traffic. A 95 % POP + 80 % shield combination means origin sees 1 % of the user requests.
POP hits / total requests = POP hit rate Shield hits / POP misses = shield hit rate Origin hits / shield misses = origin RPS -
Pre-warm new POPs after major events. When the CDN adds POPs (or a new region launches), the new POPs start cold. For a launch with predictable hot objects, pre-warm them by having a known-good URL prober hit each POP.
Operational notes
- Hit rate dilution is biggest for sites with broad, evenly-distributed traffic. Sites with a long tail benefit more from tiered cache because the tail objects stop hitting origin from every POP.
- A misconfigured
Varyheader can fragment the cache across content-type / language variants, making the effective POP cache much smaller than its byte size suggests. - “Cache hit rate” reported in the CDN dashboard usually includes the shield tier; the per-POP hit rate is lower and that is what affects user-perceived latency on the cold side.
- Tiered caching does not help purge propagation — a purge still needs to reach every POP. Test purge latency separately.
- Origin shield is not a free lunch: a misconfigured shield concentrates failures (one POP outage breaks everyone). Pick a shield region with redundancy.
In the engagements we run, the question is rarely “do we need a CDN” — it is “are we using the CDN we have correctly”. Stack Harbor’s managed operations practice includes auditing the cache rules, the tiered cache settings, and the origin egress metrics so the CDN earns its cost rather than masking the application’s missing cache headers.