Skip to content
Tutorials Center
My learning

Topics

Lesson 12 of 36 ยท CDN and Caching

Tiered Cache, Cache Reserve and Origin Shielding in Cloudflare

Raise your cache hit ratio and cut origin load with Cloudflare Tiered Cache, Smart Topology, Regional Tiers and Cache Reserve persistent storage.

With plain caching, every data center is an island. A site with visitors in 100 cities may have 100 separate first requests for the same file, each one hitting your origin. For popular files that is acceptable; for the long tail of rarely viewed pages it is a disaster, since most never get a second visit before they expire. Tiered Cache and Cache Reserve attack exactly this problem.

Tiered Cache

With Tiered Cache enabled, data centers are organized in layers:

  • Lower tier: the data center near the visitor.
  • Upper tier: one or a few larger data centers chosen for the origin, usually close to it.

When the lower tier has a miss it asks the upper tier. Only if the upper tier also misses is the origin contacted. The origin therefore sees roughly one request per file per upper tier, instead of one per data center.

flowchart LR
  V1["Visitor Tokyo"] --> L1["Lower tier TYO"]
  V2["Visitor Sydney"] --> L2["Lower tier SYD"]
  V3["Visitor Paris"] --> L3["Lower tier CDG"]
  L1 --> U["Upper tier FRA"]
  L2 --> U
  L3 --> U
  U --> O["Origin"]

Three misses in three cities produce one request to the origin.

Smart Tiered Cache Topology

Enabling it takes one click in Caching > Tiered Cache and is free. Smart Tiered Cache Topology automatically picks the best upper tier for your origin by measuring latency from Cloudflare data centers to it. Customers with multiple origins, such as different object storage buckets, get a good upper tier for each. Paid tiers add custom topologies (you pick the layout) and Regional Tiers, an extra middle layer to improve hit ratios for global audiences.

When it helps

  • Large sites with a big long tail of files.
  • Origins that are slow, far away or billed per request or per gigabyte of egress.
  • Traffic spread over many regions.

When it does not

Dynamic responses that are not cached gain nothing. It also does not help tiny sites with traffic in one region, since a single data center does most of the work anyway.

JS Stand-in: origin requests with and without tiers

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The numbers show the principle: ten cities cost ten origin fetches without tiering, and one with it. Real savings depend on how long files stay cached and how traffic is distributed.

Cache Reserve

Even with tiers, a file can fall out of cache when its TTL expires or when a data center evicts it to make room for hotter content. Edge caches are volatile: they are optimized for speed, not for keeping everything forever. Cache Reserve is a paid, persistent layer built on top of Cloudflare's object storage (R2, covered in chapter 6). Eligible cacheable responses are stored there for as long as their TTL allows (it works best with long TTLs, often thirty days or more), and edge data centers read from it on a miss before going to the origin.

It suits:

  • Rarely requested but expensive-to-regenerate files: old images, video segments, software downloads.
  • Origins with high egress fees (large cloud buckets).
  • Sites where a drop in hit ratio would hurt, for example during a flash crowd.

It is billed by storage and by read/write operations, so estimate before enabling it; for tiny sites regular caching and Tiered Cache are plenty. Enable it in Caching > Cache Reserve and check its analytics to see how many origin requests it saves.

Choosing the right layer

Need Use
Fewer origin hits across many regions Tiered Cache (Smart Topology)
Keep files long after volatile eviction Cache Reserve
Absorb bursts of identical requests Request collapsing (automatic)
Serve a stale copy while updating stale-while-revalidate

Request collapsing deserves a note: when many visitors request an uncached file at the same moment, Cloudflare sends a single request to the origin and makes the others wait for that response, instead of forwarding all of them. This protects the origin during sudden spikes of popular URLs.

Origin protection checklist

  1. Enable Tiered Cache (it costs nothing).
  2. Give files realistic TTLs; very short TTLs defeat every cache layer.
  3. Sort and normalize query strings in the cache key (next lesson) so one file has one entry.
  4. Use ETag for cheap revalidation.
  5. Allow only Cloudflare IP ranges at the origin firewall, so no traffic bypasses the cache.
  6. Consider Cache Reserve for long-tail media.
  7. Monitor the hit ratio and the origin's request log together.

Measuring the effect

In Analytics > Cache look at cached requests versus uncached, and cached bandwidth versus uncached. A drop in origin CPU or egress after enabling tiers is the best proof. The cf-cache-status header does not distinguish lower and upper hits, but analytics and logs (chapter 8) do show tiered cache fields.

JS Stand-in: hit ratio calculator

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does Tiered Cache do on a lower-tier miss?

    The upper tier acts as a shared cache that shields the origin.
  2. 2. What problem does Cache Reserve solve?

    It stores eligible cacheable responses persistently so edge evictions do not force origin fetches.
  3. 3. Which sites benefit most from Tiered Cache?

    Global audiences and long-tail content produce many independent misses that the upper tier can absorb.
  4. 4. What is request collapsing?

    It prevents a thundering herd on the origin when many visitors ask for an uncached file at once.

Summary

  • Tiered Cache lets lower-tier data centers share an upper tier, cutting origin requests.
  • Smart Tiered Cache Topology picks the upper tier automatically and is free.
  • Cache Reserve adds persistent, paid storage for long-lived cacheable content.
  • Request collapsing, good TTLs and clean cache keys protect the origin further.

Next: Purging and cache keys