Key Takeaways
- Zstandard cache transcoding shrinks eligible text assets by up to 2.8x.
- Encoding is paid once per cache fill; decoding on every serve keeps CPU overhead low.
- Frees petabytes of edge storage and slashes backbone bandwidth, especially with Tiered Cache.
Table of Contents
Inside the Cache Transcoding Prototype That Shrinks Text Assets by Up to 2.8x
Cloudflare has published a detailed technical breakdown of an internal cache transcoding prototype that compresses eligible text assets with Zstandard inside its Pingora-powered cache layer.
The work remains an engineering prototype rather than a generally available feature, but its measured results point to a significant shift in how CDN operators can expand effective cache capacity.
The goal is straightforward: expand effective cache capacity and cut cross-datacenter bandwidth by storing HTML, JSON, CSS, and JavaScript in a denser representation before those assets move through Tiered Cache.
The architecture pays a modest CPU cost once on cache fill, then reuses the compressed object on every subsequent hit. That trade, Cloudflare’s engineering team argues, can generate petabytes of effective storage capacity while reducing backbone traffic between data centers.
How Zstandard Compression Changes Cache Economics at the Edge
Cache Transcoding begins with a cache miss. When an origin sends an uncompressed response, the Pingora-based proxy encodes the body with Zstandard before writing it to disk and records that the stored representation is compressed.
Before the response leaves the client-facing tier, it is decoded back to its original identity form. On every later cache hit, the stored zstd object is read from disk and decoded only once.
Why Zstandard Instead of Brotli or Gzip
Zstandard is a lossless algorithm that Facebook’s Yann Collet released as open source in 2016. It balances compression ratio with speed, making it suitable for a cache path that touches large volumes of traffic.
In earlier browser compression testing cited by the engineering team, Zstandard compressed data 42% faster than Brotli while producing roughly the same file size. It also generated files 11.3% smaller than gzip at a comparable speed.
The Eligibility Filter That Avoids Wasted CPU
The fastest compression operation is the one never performed. Cache Transcoding therefore applies a series of eligibility checks to avoid content that would burn CPU without meaningful storage gains.
The prototype only transcodes a 200 OK response when Content-Encoding is unset, Content-Type belongs to compressible text, and a known Content-Length is at least 4 KiB.
- Compressible text — HTML, JSON, CSS, and JavaScript represented 67.3% of requests and 22.3% of bytes in the sampled traffic.
- Media and fonts — Images, video, and fonts represented 21.4% of requests but 63.3% of bytes, making them poor targets for further compression.
Within the text slice, approximately 71% arrived uncompressed with Content-Encoding unset and responded well to transcoding. The 4 KiB threshold removed a large number of tiny requests while excluding only about 1% of otherwise eligible bytes.
The Cost Model: Encode Once, Decode on Every Serve
Encoding at zstd level 3 cost about 4.31 nanoseconds per byte, or roughly 232 MB/s, paid once per cache fill. Decoding cost 1.56 nanoseconds per byte, approximately 641 MB/s, on every served request.
Because assets are served far more often than they are filled, the model kept extra CPU cost to a few percent under the tested traffic and reuse assumptions. The measured compression ratio in the controlled corpus was 2.834x.
How the Compressed Object Moves Through Tiered Cache
With Tiered Cache enabled, the compressed representation moves from the upper tier to the lower tier in zstd form. Decoding happens only on the client-facing hop.
If the lower tier misses but the upper tier already holds the object, the compressed object moves directly between tiers and stays compressed on the wire and on disk. A storage encoding marker prevents the object from being encoded more than once as it passes through cache layers.
Testing the Architecture at Fleet-Like Scale
The correctness campaign varied cache keys to force each request through cache misses, hits, single-hop fills, and Tiered Cache fills. Traces confirmed where encoding and decoding occurred at each stage.
One performance campaign sent more than one million requests across 10 cache servers, with half running Tiered Cache disabled and the other half enabled. The two assets were approximately 195 KiB and 272 KiB, both compressing by roughly 2.8 times.
The team notes that this test corpus was deliberately compressible and does not represent every text object on the Internet, so broader evaluation is needed before treating the ratio as a fleet-wide constant.
What Zstandard’s HTTP Maturity Means for CDN Compression Strategy
The HTTP compression landscape has shifted since gzip became the universal baseline. HTTP.dev’s compression reference notes that Zstandard supports a wide range of compression levels while keeping decompression fast, and all modern browsers now support it.
Crucially, the Zstandard HTTP content coding caps encoder window size at 8 MB and requires decoders to support at least 8 MB. That guardrail is designed to prevent excessive memory consumption in browsers and other HTTP clients.
For cache transcoding, the real strategic shift is separating compression from origin behavior. Rather than relying on whether a site sends gzip or Brotli, the cache layer compresses eligible assets after the origin response arrives.
That means a cache operator can capture denser storage and lower cross-datacenter transfer even when origins do not optimize their responses at all. The economics improve with every reuse because the encoding cost is paid only once.
The strict distinction between lossless HTTP content coding and lossy media compression also matters. Lossy compression such as JPEG, MP3, and H.264 happens at the content format level before HTTP transmission, while transcoding operates losslessly on the byte representation.
The same compression reference points to newer dictionary-compressed content codings: dcz for dictionary-compressed Zstandard and dcb for dictionary-compressed Brotli. Both embed a SHA-256 hash of the dictionary for client verification, and dcz uses a skippable frame header that keeps the format compatible with existing Zstandard decoders.
Vendor documentation from Huawei Cloud’s CDN adds a useful contrast: its Smart Compression service files .js, .html, .css, .xml, .json, .shtml, and .htm types, and lists Brotli performance as 15% to 25% higher than gzip. That figure is vendor-stated and specific to static content delivery, but it reinforces Brotli’s ratio advantage at the cost of slower compression.
The competitive tension is clear. Brotli remains strong for browser-facing HTTP compression, while Zstandard’s faster encode and decode profile makes it a more natural fit for internal cache transcoding across high-reuse object stores.
The New Math for Edge Storage: Pay Once, Save on Every Serve
Cache Transcoding reframes storage efficiency as a one-time encoding cost against continuous savings on disk and backbone bandwidth every time a compressed object is reused. For teams optimizing content delivery and cache efficiency, WordPress Speed Engineering is how Andres SEO Expert approaches performance engineering — reach out directly.
Frequently Asked Questions
What is Cloudflare’s cache transcoding prototype?
Cache transcoding is an engineering prototype that compresses eligible text assets with Zstandard inside the Pingora-powered cache layer. It expands effective cache capacity and reduces cross-datacenter bandwidth by storing HTML, JSON, CSS, and JavaScript in a denser representation before they move through Tiered Cache.
How does Zstandard compression compare to Brotli and gzip?
Zstandard compresses data 42% faster than Brotli while producing roughly the same file size, and generates files 11.3% smaller than gzip at comparable speed. This makes it more suitable for cache paths handling large traffic volumes than Brotli or gzip.
What types of content are eligible for cache transcoding?
The prototype only transcodes 200 OK responses when Content-Encoding is unset, Content-Type is compressible text such as HTML, JSON, CSS, and JavaScript, and Content-Length is at least 4 KiB. Media and fonts are excluded because they are already compressed.
How does the cost model of cache transcoding work?
The cost model pays a CPU cost once on cache fill, encoding at zstd level 3 costs roughly 4.31 nanoseconds per byte, and then decodes on every serve at 1.56 nanoseconds per byte. Since assets are served far more often than filled, extra CPU cost stays low.
How does the compressed object move through Tiered Cache?
With Tiered Cache enabled, the compressed representation moves from the upper tier to the lower tier in zstd form, and decoding only happens on the client-facing hop. A storage encoding marker prevents the object from being encoded more than once as it passes through cache layers.
What is the significance of Zstandard’s HTTP content coding maturity for CDN compression strategy?
Zstandard is supported by all modern browsers and caps encoder window size at 8 MB. It allows cache operators to compress origin responses independently, enabling denser storage and lower cross-datacenter transfer even when origins do not optimize responses.
What storage and bandwidth benefits does cache transcoding provide?
Cache transcoding can generate petabytes of effective storage capacity and reduce backbone traffic. The compression ratio in the controlled corpus was 2.834x, and the encoding cost is paid once while savings accrue on every serve.
