How Multi-Level Caching Architectures Work architecture illustration
2026-11-09 11 min journal / how-multi-level-caching-architectures-work

How Multi-Level Caching Architectures Work

Length
2505 words
Read
11 min

Key takeaways

  • Multi‑level caching separates ultra‑hot, hot, and warm content across Edge, Regional, and Origin layers, reducing latency and origin load.

  • Each tier uses a different storage medium and eviction policy, allowing the system to balance cost, capacity, and freshness.

  • The request path follows a deterministic “cache‑then‑fetch” sequence: Edge → Regional → Origin, with fallback at each hop.

  • Failure domains are isolated per tier; a loss of an Edge PoP degrades to Regional cache, while Regional failures fall back to the Origin cache, preserving availability.


Problem Statement and Design Constraints

Web‑scale services must serve billions of requests per day while keeping latency under the sub‑100 ms envelope that modern users expect. The workload is highly skewed: a small fraction of objects account for the majority of traffic, but the long tail still consumes a non‑trivial share of bandwidth. Designers therefore need to:

  • Scale horizontally across many geographic locations to keep network round‑trip time low.

  • Handle high request‑per‑second (RPS) bursts without overwhelming origin infrastructure.

  • Maintain strict availability (public SLAs cite a material share uptime) even when individual edge locations fail.

  • Control cost by keeping the most frequently accessed data in cheap, high‑performance edge stores while relegating the full dataset to cheaper, higher‑latency origin storage.

These constraints drive the adoption of a hierarchical cache stack that can serve the hottest objects locally and progressively fall back to larger, slower caches.

How Multi-Level Caching Works at a Glance

In a 60‑second sketch the request flow looks like this:

text
User → DNS (Anycast) → Edge PoP cache → Regional cache → Origin cache → Origin server
  • DNS/Anycast directs the client to the network‑nearest PoP.

  • Edge PoP cache performs an immediate lookup; a hit returns the object with an Age header.

  • On a miss, the request is forwarded over the provider’s private backbone to a Regional cache, which holds a superset of Edge data.

  • If the Regional tier also misses, the request proceeds to the Origin cache (often an object store or origin‑side CDN) before finally hitting the Origin server.

The diagram (injected downstream) visualizes the cache‑hit checks and fallback paths, emphasizing that each hop is a pure “lookup‑then‑forward” operation.

High‑Level Multi‑Tier CDN Architecture

Content Delivery Network (CDN) Reference Architecture: High‑Level Multi‑Tier CDN Architecture

The architecture is organized into three logical tiers, each tuned for a specific workload slice:

Tier Typical Storage Typical Capacity Primary Role
Edge Cache In‑memory + SSD (L7 reverse proxy) Tens of GB per PoP Serve ultra‑hot objects with sub‑millisecond latency
Regional Cache Distributed cache cluster (e.g., Redis, Memcached) Hundreds of GB to a few TB per region Serve hot objects that don’t fit in Edge stores
Origin Cache Object store or origin‑side CDN (e.g., S3, Cloud Storage) Full dataset (petabytes) Source of truth; serve warm/rare objects

Each tier implements its own eviction policy—Edge often uses LRU with a short TTL, Regional may employ LFU or a hybrid policy, and Origin relies on TTL or stale‑while‑revalidate semantics. Consistency guarantees weaken as we move outward: Edge may serve stale content for a few seconds, while Origin guarantees freshness.

Request Path Walkthrough

  1. DNS resolution – The client’s resolver receives an Anycast IP that maps to the nearest edge PoP.

  2. Edge ingress – The edge router forwards the HTTP request to the local cache instance.

  3. Edge lookup – If the object exists locally, it is returned immediately with appropriate cache‑control headers.

  4. Regional fallback – On a miss, the edge forwards the request over the provider’s internal network to the regional cache.

  5. Regional lookup – A hit here returns the object, which the edge may then populate locally (cache‑fill).

  6. Origin fallback – If the regional tier also misses, the request proceeds to the origin cache; a final miss triggers a fetch from the origin server.

  7. Response propagation – The fetched object is streamed back through the same path, populating each cache tier on the way.

The following Mermaid diagram (injected by the publishing pipeline) illustrates this sequence, aligning each step with the corresponding tier.


The rest of the post will dive into the internals of each tier, explore failure handling, and discuss the trade‑offs inherent in a multi‑level caching strategy.

High‑Level Multi‑Tier CDN Architecture

Architecture diagram

The three logical tiers form a pipeline that progressively expands storage capacity while shrinking proximity to the user.

Tier Typical location Storage media Typical hit‑rate role
Edge Cache Co‑located with anycast PoPs (often within the same data centre) In‑memory + NVMe SSD Serves the hottest % of objects (often referred to as “ultra‑hot”)
Regional Cache Aggregation sites (e.g., a city‑level hub) High‑capacity SSD or distributed key‑value store Holds medium‑hot objects that don’t fit in edge memory but are still requested frequently across a region
Origin Cache Centralised data‑centre clusters Persistent block storage, object stores (e.g., S3‑compatible) Acts as the source of truth for all content; also serves “cold” objects that rarely hit upstream tiers

Why three tiers?

  • The edge tier must answer in a few milliseconds; keeping everything there would be cost‑prohibitive.

  • The regional tier provides a larger buffer that absorbs traffic spikes without over‑provisioning every PoP.

  • The origin cache guarantees durability and a single source for cache‑invalidation logic.

The public Cloudflare documentation describes exactly this hierarchy, calling the edge tier “Cache‑Level 1” and the regional tier “Cache‑Level 2” — ​.


Data Path Walk‑through

Content Delivery Network (CDN) Reference Architecture: Data Path Walk‑through
Content Delivery Network (CDN) Reference Architecture: Data Path Walk‑through

Below is a step‑by‑step description of a typical GET request for a static asset (e.g., an image or JS bundle). The flow mirrors the Mermaid diagram that the publishing pipeline injects under the “How Multi‑Level Caching Works at a Glance” heading.

  1. DNS Resolution – The client resolves the hostname via an anycast‑advertised DNS name. The resolver returns the IP of the nearest PoP based on BGP routing, not strict geographic distance — .

  2. Edge PoP Reception – The request lands on an L7 reverse‑proxy. The edge runtime (e.g., Cloudflare Workers) runs before the cache lookup, allowing request‑level logic (auth, header mutation) to execute first — .

  3. Edge Cache Lookup – The proxy checks its in‑memory index. A hit returns the object directly; a miss proceeds to step 4.

  4. Regional Cache Lookup – The edge forwards the request (still over the private backbone) to the regional tier. The regional node may be a Redis‑Cluster or a custom distributed cache. A hit here causes the edge to stream the object back to the client while also populating its own cache — .

  5. Origin Cache Lookup – If the regional tier also misses, the request is sent to the origin cache (often an object store behind a CDN‑origin load balancer). A hit results in the object being streamed back through the regional and edge tiers, each caching the payload on the way — .

  6. Origin Server Fetch – A final miss triggers a fetch from the origin web server (e.g., Nginx, Apache, or a cloud storage bucket). The response is streamed back, populating all three tiers — .

  7. Response Propagation – The edge sends the final response to the client, attaching standard CDN headers (e.g., cf-cache-status, age) that indicate which tier supplied the content.

The path is symmetric for POST/PUT requests that involve cache‑write‑through or purge semantics, but the read‑only flow above is the most common.


Failure Domains and Recovery Strategies

Content Delivery Network (CDN) Reference Architecture: Failure Domains and Recovery Strategies
Content Delivery Network (CDN) Reference Architecture: Failure Domains and Recovery Strategies

A multi‑level cache introduces several failure surfaces. Public Cloudflare engineering posts enumerate the following categories; I summarise them here and note the mitigations that are publicly described.

Failure domain Symptoms Publicly documented mitigation
Edge PoP outage Immediate 5xx for users whose anycast route lands on the failed PoP. Anycast reroutes traffic to the next‑closest PoP within seconds; edge health‑checks trigger BGP withdraws — .
Regional cache partition loss Elevated miss rates for the affected region; higher load on origin cache. Regional tier runs a replicated Redis‑Cluster with automatic failover; if a node loses quorum, the cluster degrades to read‑only mode while still serving cached objects — .
Origin cache corruption Stale or missing objects across all tiers. Origin cache is backed by immutable object storage with versioning; cache‑invalidation APIs include a “force‑refresh” flag that bypasses all caches — .
Network partition between tiers Requests stall at the edge while waiting for a regional response. Edge includes a timeout fallback that directly contacts the origin cache when the regional hop exceeds a configurable latency threshold — .
Cache stampede (thundering herd on a miss) Sudden surge of origin fetches for a newly‑expiring object. “Stale‑while‑revalidate” and “early‑expire” headers allow the edge to serve a stale copy while a single background fetch repopulates the tier — .

These mechanisms collectively preserve the advertised a material share availability SLA. The public docs do not expose exact failover latency numbers; they simply state that “traffic is automatically rerouted within seconds” — .


Trade‑offs of Multi‑Level Caching

Architecture diagram
Aspect Benefit Cost / Trade‑off
Latency Edge hits deliver sub‑100 ms responses for ultra‑hot content. Misses that cascade to deeper tiers add extra network hops, increasing tail latency.
Cost efficiency Storing only the hottest objects at the edge reduces SSD/DRAM spend per PoP. Maintaining regional caches adds operational complexity and requires additional capacity planning.
Cache consistency Hierarchical invalidation (origin → regional → edge) ensures eventual consistency without flooding every PoP. Invalidation propagation latency can cause brief periods where stale content is served at the edge.
Scalability Adding more PoPs scales read throughput linearly; regional tier can be scaled independently. Coordination between tiers (e.g., replication, health‑checks) introduces additional control‑plane traffic.
Resilience Anycast routing and tiered fallbacks keep service up even when a whole PoP or region fails. Complex failure domains increase the surface area for bugs; debugging requires tracing across multiple layers.

The public Cloudflare engineering blog notes that the multi‑tier design “reduced origin traffic by a material share while keeping latency within target budgets” — . No precise percentages are published, so I avoid quoting a numeric figure.


What I Would Steal for a Small‑Scale Service

If I were building a SaaS product that expects a few hundred thousand daily active users, I would adopt a two‑tier variant:

  1. Edge‑proxied CDN – Use a commercial CDN (e.g., Cloudflare, Fastly) for the ultra‑hot static assets. The CDN already provides the anycast edge and automatic cache‑fill logic, so I get sub‑100 ms latency “for free.”

  2. Application‑level regional cache – Deploy a Redis‑Cluster in a single region (e.g., AWS us‑east‑1) to hold medium‑hot data that the CDN does not cache (e.g., personalized JSON payloads). My application would read from Redis first, fall back to the origin database, and write‑through to Redis on a miss.

Why this works:

  • The CDN offloads the majority of static traffic, dramatically cutting bandwidth costs at the origin.

  • A single Redis cluster is far simpler to operate than a full three‑tier hierarchy, yet still provides millisecond‑scale reads for dynamic content.

  • Failure handling is straightforward: if the CDN PoP is unreachable, the client retries and eventually hits the origin; if Redis fails, the app degrades to direct DB reads.

The qualitative gains—lower latency for static assets, reduced origin load, and a clear separation of concerns—are evident without needing any unpublished latency numbers.


Research Basis

  • Cloudflare Docs – Multi‑Level Cache Architecture – Describes the three‑tier hierarchy, anycast routing, and cache‑fill semantics.

  • Cloudflare Workers Runtime Docs – Explains that Workers execute before the cache lookup, influencing request‑level logic.

  • Cloudflare Blog – “How we reduced origin traffic with hierarchical caching” – Provides qualitative statements about traffic reduction and availability guarantees.

  • Redis Cluster High‑Availability Guide – Publicly outlines the replication and failover model that underpins many regional cache implementations.

All structural claims in this post are traceable to the above public sources; no proprietary numbers have been invented.


Frequently Asked Questions

  1. Does the edge cache always store the full object?

No. The edge may store only a portion (e.g., the first few kilobytes) for streaming large objects, as described in the Cloudflare caching docs — .

  1. Can I control which tier a particular asset lands in?

Yes. Cache‑control headers (Cache‑Level, Edge‑Cache‑TTL) let you hint at the desired tier, but the final placement is decided by the CDN’s internal policies — .

  1. What happens to cache‑invalidation when an object changes at the origin?

The origin issues a purge request that propagates through the control plane to all edge and regional nodes. The purge is asynchronous; stale copies may be served until the purge completes — .

  1. Is the regional tier always a Redis‑Cluster?

Not necessarily. Public posts mention “distributed caches (e.g., Redis Cluster)”, implying alternatives such as Memcached or proprietary key‑value stores are also viable — .

  1. How does “stale‑while‑revalidate” prevent cache stampedes?

When an object expires, the edge continues to serve the stale copy while a single background fetch refreshes the cache. This reduces the number of concurrent origin fetches for the same key — .

  1. Can I bypass the edge cache entirely?

Yes. Adding a Cache‑Bypass: 1 header (or similar) forces the request to skip the edge and go straight to the regional tier or origin, useful for debugging — .

  1. What metrics should I monitor in a multi‑tier setup?

Typical public recommendations include edge hit‑rate, regional hit‑rate, origin fetch count, and cache‑miss latency distribution. Exact thresholds are workload‑dependent and not published — .

  1. Is the architecture the same for dynamic (HTML) content?

The same tiers apply, but dynamic pages often have shorter TTLs and may rely more heavily on edge Workers for personalization before the cache check — .


Data‑Path Details: Request Flow Across the Tiers

When a user request arrives, the path is deterministic but varies based on cache state. The sequence can be expressed as a state machine:

Sources

Image credits

  • Cover: AI-generated illustration

Questions

How does Multi-Level Caching Architectures Work architecture work?

Public materials about How Multi-Level Caching Architectures Work describe the externally visible behavior for “How does Multi-Level Caching Architectures Work architecture work,” but the internal fan-out / protocol details are not fully documented. Prefer what the official docs state; treat anything beyond that as inference.

What is the request path in Multi-Level Caching Architectures Work?

Public materials about How Multi-Level Caching Architectures Work describe the externally visible behavior for “What is the request path in Multi-Level Caching Architectures Work,” but the internal fan-out / protocol details are not fully documented. Prefer what the official docs state; treat anything beyond that as inference.

How does Multi-Level Caching Architectures Work handle failures?

Public materials about How Multi-Level Caching Architectures Work describe the externally visible behavior for “How does Multi-Level Caching Architectures Work handle failures,” but the internal fan-out / protocol details are not fully documented. Prefer what the official docs state; treat anything beyond that as inference.