Skip to content

CDN Architecture Diagram: Edge Caching, Origin Shield and Cache Keys

Follow a request through a CDN, from routing and cache keys to origin shielding, revalidation, purging and the metrics that reveal origin load.

· Founder & developer

Published

Two groups of users connect through routing to two CDN edges. Both edges lead to an origin shield, then an origin load balancer, application and object storage. Dashed arrows show purge and telemetry paths.

A product launch attracts visitors from several continents. The application stays healthy in a load test, yet launch traffic overwhelms the origin with requests for the same images and JavaScript files. Adding an edge cache helps, but only if requests for identical content actually share a cache entry.

A CDN architecture diagram should explain that reuse, not just put a cloud between the browser and your servers. This guide follows hits and misses, shows where an origin shield belongs, and connects cache keys, headers, invalidation and monitoring to the request path.

Start with routing and two different paths

A content delivery network receives requests at distributed points of presence, often called PoPs. Depending on the provider, routing uses DNS answers, anycast routing, or a combination. Nearby on a map does not necessarily mean the lowest network latency: routing and provider capacity also matter. The DNS diagram explains the name-resolution step.

At an edge, a cache hit returns a reusable stored response without fetching its body from the origin. A miss continues upstream. An expired entry can take a third path: conditional revalidation, where a validator lets the origin confirm that the stored representation is still current. Draw these paths separately because their costs differ.

Path Upstream work What to watch
Fresh edge hit No origin fetch Edge latency and bytes served
Shield hit after an edge miss Request reaches the shield Regional reuse and shield latency
Full miss Origin returns the representation Origin requests, bytes and latency
Revalidation Upstream checks a validator Validation requests and response status

The diagram is a logical request path. It does not claim that every request visits every box, or that a CDN provider uses exactly this physical topology.

Design the cache key before increasing the TTL

The cache key determines which requests may share a response. Start with the host and resource path, then explicitly decide which query parameters, headers and cookies affect the representation. Provider configuration may add or remove dimensions beyond the standard HTTP cache model.

If an image URL contains an irrelevant tracking parameter, including that parameter can create many entries containing identical bytes. Conversely, dropping a parameter that chooses a tenant or language can serve the wrong representation. Normalize only when the application agrees that the normalized requests are equivalent.

RFC 9111 describes how HTTP caches select stored responses, including request headers named by Vary. A response varying on a header must match that dimension before reuse. An unbounded dimension, such as arbitrary user-agent strings, can fragment the cache badly.

Keep authenticated and personalized responses out of shared caching unless you have designed the policy deliberately. A session cookie is not automatically a safe partition key. Review both the origin headers and the CDN rules; a dashboard rule that overrides a header can change the result. Test with two different users, not only an anonymous request.

Read Cache-Control as a reuse policy

Freshness tells a cache when it may reuse a stored response without validating it. It is not a promise that the origin will push an update when the representation changes.

Directive Meaning for the design
max-age=60 The representation stays fresh for 60 seconds under this policy
s-maxage=300 A shared cache uses a 300-second freshness lifetime instead of max-age
private Shared caches must not store this response
no-store Do not store this response
no-cache Storage is allowed, but reuse requires successful validation
stale-while-revalidate=30 Where supported and allowed, serve stale briefly while refreshing
stale-if-error=600 Where supported and allowed, stale content may answer certain upstream errors

The stale extensions come from RFC 5861. Treat their values as explicit product decisions, not general recommendations. An old product illustration and an old account balance have very different consequences. Other directives and provider policies can constrain stale reuse.

An illustrative policy for a public, frequently updated document is:

Cache-Control: public, max-age=60
ETag: "catalog-v17"
Vary: Accept-Encoding

The validator identifies a representation for later conditional requests. A successful not-modified response avoids transferring the body, but it still consumes upstream work. A high revalidation rate can therefore overload an origin even when bandwidth looks low.

Put the origin shield where misses converge

Many edge locations can miss on the same popular object. A shared intermediate cache gives those requests another chance to reuse one response before reaching the origin. CloudFront Origin Shield is one provider's implementation of this additional caching layer.

Shielding can improve origin offload, but it adds another dependency and a location choice. Compare the shield's distance from the origin, its failure behavior, and the provider's billing model. Do not infer a universal availability guarantee from the presence of a shield box.

Show the origin boundary explicitly. A load balancer can route dynamic requests to application servers, while an object store serves static assets. Restrict direct origin access where the deployment allows it; otherwise clients may bypass the CDN policy. The load balancer diagram covers the origin-side routing in more detail.

Choose an invalidation strategy

Versioned asset names make immutable deployments easier to reason about: a new build requests a new URL, while old pages can still load their matching assets. Keep old assets available long enough for cached pages and slow clients.

For mutable URLs, providers commonly offer URL purges and sometimes tag-based purges. The exact matching rules, completion guarantees and rate limits are provider-specific. A purge does not update copies already stored in a browser. Plan the browser policy and edge policy together.

Separate the control path from content delivery. A deployment or CMS event invokes the purge API; that action is not another user request passing through the cache. Record what was purged, why, and whether failures will retry. Avoid purging the entire cache on every minor update: a synchronized cold cache can produce a large origin burst.

Edge compute, TLS and security belong on the path

An edge may terminate TLS, run a WAF, rewrite a request, or execute application logic. Mark where each happens relative to cache lookup. A rewrite before lookup can change the key; a transformation after lookup may change the response without changing stored content.

Keep the diagram's security statement modest. TLS termination at the edge does not describe the edge-to-origin connection, and a WAF does not replace authorization in the application. Use the TLS handshake diagram when reviewers need protocol detail rather than adding every cryptographic step to the CDN map.

Measure reuse and origin protection separately

Request hit ratio counts requests; byte hit ratio weights large responses, such as video segments served from the edge. Both are useful, and neither is a complete latency metric. Separate results by route or content class so a healthy image cache does not hide a struggling dynamic endpoint.

Track origin request rate, origin bytes, errors, time to first byte, revalidation rate and purge failures. Compare the same traffic window when evaluating a change. A rising hit ratio during falling traffic does not prove that a key change improved the system. The caching strategies guide helps relate these measurements to application caches.

The CDN request-path diagram

Two groups of users connect through routing to two CDN edges. Both edges lead to an origin shield, then an origin load balancer, application and object storage. Dashed arrows show purge and telemetry paths.

14 components · 11 connections

Open in Archboard
Diagram contents
  • Users West
  • Users East
  • Routing
  • Edge West
  • Edge East
  • Origin shield
  • Origin load balancer
  • Application
  • Object storage
  • Purge controller
  • Telemetry
  • resolve / route
  • edge request
  • miss / revalidate
  • shield miss
  • dynamic content
  • static content
  • invalidate
  • metrics
Two edge locations share an origin shield. Cache hits stop requests early; misses continue to the application or object storage, while a separate purge path changes cached state.

How to read it:

  • The two user groups reach different edge locations through the routing layer.
  • Blue request paths can stop on an edge hit; misses continue to Origin shield.
  • The origin load balancer routes requests to Application or Object storage.
  • Dashed paths carry purge commands and telemetry rather than response bodies.
  • The Markdown block states the example cache policy and the personalized-response exclusion.

Drawing CDN diagrams clearly

Label arrows with hit, miss, revalidate or purge. A single unlabeled arrow conceals the distinction between a response body and a policy change. Keep the two edge locations as examples rather than pretending to inventory the provider's global network.

Put the cache-key dimensions near the edge, not inside the application box. Include an origin boundary, the upstream security requirement and a short legend. Move individual header examples into a note so the topology remains readable at cover-image size.

Build it in Archboard

  1. Sign in with Google or GitHub and create a diagram.
  2. Add two Internet nodes from the Network pack for the user groups, plus a DNS node for Routing.
  3. Add three CDN nodes from Network: Edge West, Edge East and Origin shield.
  4. Add a Cloud LB, Compute and Object Storage from the Cloud pack for the origin, the same generic nodes used for cloud architecture diagrams.
  5. Add a Container from the C4 Model pack for Purge controller and another for Telemetry. Connect the request path left to right; make purge and telemetry edges dashed.
  6. Add a Markdown block from Core with the cache policy, and use Core Text labels for hits, misses and the origin boundary.

The example uses 12 diagram nodes, within the Free plan.

FAQ

What does a CDN architecture diagram show? It shows routing, cache layers, the origin and control paths, with enough labels to distinguish hits, misses, revalidation and invalidation.

Is an origin shield another CDN? It is an intermediate caching layer within the chosen delivery architecture. Its purpose is to reduce repeated origin fetches from different edge locations.

Does no-cache mean never store the response? No. It requires successful validation before reuse. The no-store directive is the instruction not to store the response.

Why can a CDN have a low hit ratio? Common causes include fragmented cache keys, short freshness lifetimes, personalized content and objects that receive too few repeated requests.

Should every deployment purge the whole cache? Usually a narrower purge or versioned asset URL is easier to control. A full purge can make many edges fetch the same objects from the origin simultaneously.

Start free — one seat, no credit card.

Related posts

← Back to blog

Open a canvas in a minute

Sign in with Google or GitHub. Free for a single seat. Upgrade when the team joins.