Highlights

Contents

Part III
03

Invalidation and versioned URLs

We change what readers receive without assuming every edge updates at one instant. Purging a distributed cached identity and publishing a new identity solve different problems. We will trace invalidation, use immutable versions, separate deletion from authorization, and handle cached errors.

CHAPTER ATLAS / FOLLOW THE READING PATHCHAPTER ATLAS / FOLLOW THE READING PATH1Edges, origins, hits andmisses2TTL and Cache-Control3Invalidation andversioned URLs4Pull vs push CDN andshielding5Signed URLs and privatedelivery6Geographic routing7Video and image delivery8Case study: private videodelivery

#Section 9Invalidation reaches distributed state

A faulty image is published under a mutable key and cached at many edges. Invalidation requests that cached state for selected identities be removed or refreshed. It is a control operation over distributed caches, so request acceptance and complete propagation are different events.

Suppose an illustrative identity exists at 64 edges. The system needs the invalidation applied wherever the old response can still be reused, and also needs to consider intermediate caches and browsers. A completion status from one control API must be interpreted according to that product’s scope rather than assumed to clear every copy on the internet.

INVALIDATION TRAVELS TO COPIES THAT MAY STILL BE SERVINGINVALIDATION TRAVELS TO COPIES THAT MAY STILL BE SERVINGappliedpendingappliedpurge keyrequest accepted ≠ every edge has applied itillustrative propagation state, not measured elapsed time
Figure 14.10Illustrative invalidation propagation. Some serving sites have applied the purge while another still has it pending. Accepting an invalidation request does not prove every serving copy has changed.

CloudFront invalidation guidance presents invalidation and versioned names as alternatives for content updates. Verify path matching, variant handling, and completion semantics. An invalidated key can be refetched immediately, so updating origin to the correct content and protecting cold-load demand are part of the operation.

#Section 10Versioned names avoid mutable identity races

Heron publishes clip-c7-v2 as a new immutable object and changes the database pointer from clip-c7-v1. Readers already using v1 keep consistent bytes; new readers receive v2. The CDN can retain both under separate keys without guessing whether a mutable object changed halfway through a download.

Two full illustrative versions of a 5,000,000,000-byte clip retain 10,000,000,000 logical bytes. That is the storage cost of the simple example before replicas and renditions. It also costs misses for the new identity, so the publication plan may prewarm selected hot paths when measured demand justifies it.

clip-c7-v2 IS A NEW KEY: NO PURGE NEEDED, BUT TWO 5 GB OBJECTS EXISTclip-c7-v2 IS A NEW KEY: NO PURGE NEEDED, BUT TWO 5 GB OBJECTS EXISTclip-c7-v1clip-c7-v2app pointer2 × 5,000,000,000 B = 10,000,000,000 B retained until v1 is cleaned up
Figure 14.11Immutable versioned publication. Old object and access lifetimes are separate cleanup policies.

The small manifest or metadata pointer can itself be cached. Give it a freshness and invalidation rule that matches update requirements. Otherwise correct immutable content exists but viewers keep receiving the old pointer. The source object and the pointer are two distinct cache identities.

#Section 11Deletion, revocation, and stale content

A user deletes a private clip. Removing the origin object does not automatically remove all cached bytes or immediately revoke previously issued access. Deletion state should stop new authorization, and the design must state how existing capabilities and edge copies become unusable.

A signed capability expires according to its rule. An invalidation can remove cached bytes according to its propagation scope, but it is not an authorization mechanism by itself. If a client bypasses the CDN and origin remains public, removing edge state does not protect the clip. Keep origin restricted to the intended delivery path.

PURGING BYTES AND REVOKING ACCESS ARE DIFFERENT JOBSPURGING BYTES AND REVOKING ACCESS ARE DIFFERENT JOBScontent cleanuporigin delete + cache purgeaccess controlstop issuing, expire or revokea purge does not invalidate a signed URL; a revoked URL does not delete bytes
Figure 14.12Separate deletion responsibilities. A cached private byte sequence still requires access enforcement.

Some product requirements accept a bounded existing-access lifetime, while others require an additional revocation check. A per-request revocation lookup can reintroduce a dependency and cost at the edge. Choose the promise honestly, then test it with an old valid link and a warmed cache after the application marks the clip deleted.

#Section 12Negative caching and failed publication

A viewer requests a newly announced clip before its object or metadata is ready, and the CDN retains the origin’s not-found response under an allowed negative-cache rule. A negative cache stores a failure or absence response for reuse. It can protect origin from repeated absent-key requests but delay visibility after the object becomes available.

Publish verified media before announcing the reference. Choose error-cache rules deliberately and distinguish absence from permission errors and transient origin failures. An unauthorized response must not become a reusable answer for every other caller merely because the path matches.

ANNOUNCE THE CLIP TOO EARLY AND THE EDGE CACHES A 404 FOR ITANNOUNCE THE CLIP TOO EARLY AND THE EDGE CACHES A 404 FOR ITlink announcedobject not readyviewer asksorigin says 404edge caches 404for its TTLobject arrivesedge still says 404publish verified media first, then the reference
Figure 14.13Negative-cache visibility problem. Status-specific caching and publication order determine the delay.

Error responses may also include user-specific details or retry information. Their key and cache policy need the same representation and security discipline as successful content. The right fix for a publication race is not simply to disable all caching; it is to order state and choose explicit error semantics.