Highlights

Contents

Part VII
07

Video and image delivery

We apply the cache mechanisms to images, segments, and score-related traffic without mixing their units. A highly reusable media segment behaves differently from a personalized live conversation. We will compute fan-out bandwidth, distinguish request and byte hits, handle ranges, and protect transformations.

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 25Video segments and total viewer bandwidth

Heron adds an explicitly illustrative video rendition at 4,000,000 bits per second for each of 50,000 viewers. Dividing by 8 gives 500,000 payload bytes per second per viewer. Multiplying by viewers gives 25,000,000,000 bytes per second, or 200,000,000,000 bits per second, before protocol overhead.

At an illustrative segment duration of 6 seconds, a segment carries 3,000,000 bytes. Each viewer requests one such segment per interval in this idealized single-rendition model, so the total segment request rate is 50,000 divided by 6, or 8,333.333 recurring per second. Rendition switching, manifests, retries, and audio can add work.

A VIDEO STREAM IS A SEQUENCE OF CACHEABLE SEGMENTSA VIDEO STREAM IS A SEQUENCE OF CACHEABLE SEGMENTSone viewer: 4,000,000 bit/smanifest: ordered segment keysseg Aseg Bseg C6 s × 500,000 B/s= 3,000,000 B per segment50,000 viewers × 500,000 B/s = 25,000,000,000 B/s
Figure 14.29Illustrative bitrate and segment duration, not the shared live-event workload or a measured codec output.

The CDN can reuse a segment across viewers and sites, greatly reducing repeated origin reads in a suitable workload. Its edge network still sends each viewer their payload. Plan egress and geographic capacity independently from the source’s unique-segment production rate.

#Section 26Request hit ratio and byte hit ratio

A dashboard shows 90% request hits and the team expects 90% origin bandwidth reduction. Use an illustrative batch of 100 requests: 90 small 2,000-byte responses all hit, while 10 large 1,000,000-byte objects all miss. Hit payload is 180,000 bytes and total payload is 10,180,000.

The byte hit fraction is 180,000 divided by 10,180,000, or about 0.01768172888, which is a rounded computed value of about 1.768172888%. Origin still supplies 10,000,000 of the payload bytes. The request statistic is correct but answers a different question.

hb=bytes served from reusable cachetotal delivered bytes.h_b=\frac{\text{bytes served from reusable cache}}{\text{total delivered bytes}}.

Read this as byte hit fraction hbh_b equals cached delivered bytes divided by all delivered bytes under the chosen accounting definition. Use the same byte scope in numerator and denominator, and account for ranges or compression consistently.

90 OF 100 REQUESTS HIT, BUT ONLY 1.768% OF THE BYTES DO90 OF 100 REQUESTS HIT, BUT ONLY 1.768% OF THE BYTES DOrequests: 90% hitsbytes: 180,000 of 10,180,00090 × 2,000 B small hits · 10 × 1,000,000 B large missessize the origin link with byte hits, not request hits
Figure 14.30Computed unequal-size example. Rounded displayed fractions come from the retained numeric ledger.

#Section 27Range requests and stable bytes

A viewer seeks within a large clip and requests a byte range rather than the full object. A range request asks for selected portions under HTTP’s supported representation rules. CDN handling of partial responses, stored ranges, and origin fetch size is product-dependent.

For an illustrative 1,000,000-byte range from a 5,000,000,000-byte immutable source, the fraction is 0.0002, or 0.02%. Do not assume origin transfers only that range unless the chosen product documents it. It may fetch different chunks or complete objects according to cache and origin behavior.

THE VIEWER ASKED FOR 1,000,000 B; WHAT THE EDGE FETCHES FROM ORIGIN IS PRODUCT-SPECIFICTHE VIEWER ASKED FOR 1,000,000 B; WHAT THE EDGE FETCHES FROM ORIGIN IS PRODUCT-SPECIFIC5,000,000,000 B immutable source1 MB (0.02%)origin fetch: measure ita stable versioned key keeps all ranges on the same bytes
Figure 14.31Range sizing exercise. It describes requested bytes rather than a vendor’s guaranteed origin transfer.

Immutable identity prevents different range reads from accidentally combining different versions. Validators and conditional range handling must remain compatible. If a mutable object changes, a client or cache needs the protocol’s correct response rather than quietly assembling old and new ranges into one corrupt file.

#Section 28Images, transformations, and score conversations

An image path allows arbitrary width and format query values. If every request creates a new transformation and key, an attacker can bypass reuse and exhaust origin processing. Validate and normalize a bounded set of supported sizes and formats, then include every true representation choice in the cache key.

An illustrative 1,000 requests per second with unique fragmented keys can create 1,000 original misses per second even though their underlying source is the same. Coalescing only identical keys cannot rescue that design. A controlled transformation catalog improves reuse and bounds expensive work without mixing distinct image bytes.

TRANSFORMED REPRESENTATIONS NEED DISTINCT CACHE IDENTITIESTRANSFORMED REPRESENTATIONS NEED DISTINCT CACHE IDENTITIESoriginalsmallwidthlargewidthencodedformatversion + transformation parameters define representation identity
Figure 14.32Transformation path. Restricting choices protects processing and avoids accidental unlimited key creation.

Heron’s shared live-score event path is different. Twenty events per second delivered to 50,000 viewers create 1,000,000 deliveries and 200,000,000 payload bytes per second at 200 bytes each. A persistent personalized connection is not simply an immutable CDN segment, although infrastructure at the edge can still proxy or terminate it under different semantics.

SCORES: 200,000,000 B/S TO 50,000 VIEWERS. VIDEO: 25,000,000,000 B/S. DIFFERENT WORKLOADSSCORES: 200,000,000 B/S TO 50,000 VIEWERS. VIDEO: 25,000,000,000 B/S. DIFFERENT WORKLOADSscore events200 B20 × 50,000 × 200 B200,000,000 B/svideo renditionsegsegsegseg4,000,000 bit/s × 50,000 ÷ 825,000,000,000 B/snever size one path with the other's payload or rate
Figure 14.33Two explicitly separate delivery models. Do not size one with the other’s payload or request rate.

Static assets, photos and video at real services

The same three cache shapes cover most public examples. Static assets such as JavaScript bundles, stylesheets and fonts are the easiest case: the build puts a content hash in the file name, the response carries a long max-age with immutable, and a new release publishes new names instead of purging old ones. An HTML page that references those names stays short-lived, so a deploy changes one small document rather than every cached script.

A photo service such as Instagram stores each upload once and serves a small fixed set of renditions, for example a thumbnail, a feed size and a full size. That is the bounded transformation catalog above. Each rendition is immutable under its own URL, so a popular photo is fetched from origin roughly once per edge or shield and then served as hits, while a private account adds the per-request permission check from Part V.

Video platforms push the idea furthest because bytes, not requests, dominate. Netflix publishes its Open Connect program, which places Netflix-operated cache appliances inside or next to internet service provider networks and fills them with the catalogue during quiet hours, a push model from Section 14. YouTube serves from Google’s edge network and its ISP-hosted Google Global Cache nodes, which fill on demand closer to the pull model. Both split a title into renditions and short segments, so the arithmetic of Section 25 applies per segment rather than per film.