Cloudflare Tests Cache Transcoding to Reduce Storage Costs

Cloudflare is testing a cache transcoding prototype designed to save petabytes of storage capacity by utilizing Pingora and Zstandard to compress uncompressed text responses, based on technical documents released by the edge network provider. By encoding compressible web assets before writing them to disk, the hyperscaler aims to solve physical hardware constraints across its global network.

How Cloudflare Uses Zstandard and Pingora for Cache Transcoding

To achieve these efficiency gains, Cloudflare relies on Zstandard—the lossless compression algorithm developed by Facebook for real-time use—alongside its Rust-based proxy framework, Pingora, according to technical disclosures. When an eligible HTTP response arrives from an origin server, Pingora encodes the payload into the Zstandard format before writing it to local edge disk storage.

The compressed asset remains in that encoded form while moving across Cloudflare’s Tiered Cache between regional data centers, which reduces inter-POP backhaul bandwidth consumption. When a client requests the cached asset, Pingora decodes the payload into the client’s requested representation immediately before egress transmission.

Pro Tip: According to Cloudflare’s documentation, the CPU encoding overhead is paid only once upon cache ingestion. Subsequent cache hits reuse the pre-compressed asset repeatedly without re-encoding, saving compute cycles on repeat requests.

Targeting Compressible Text and Managing CPU Trade-offs

Transcoding does not mean compressing everything indiscriminately. According to statements from Cloudflare’s Aashi Patel, images, video, and fonts are usually compressed already. In the company’s traffic sample, that media slice represented 21.4% of requests but 63.3% of bytes, meaning that attempting to compress them again would burn CPU cycles for no benefit.

Instead, Cloudflare’s Cache Transcoding targets uncompressed text responses that return successfully and are at least 4 KiB in size. The system excludes range requests, precompressed or binary content, and responses with an unknown size. Within their sample, HTML, JSON, CSS, and JavaScript made up the compressible text category—representing 67.3% of requests and 22.3% of bytes—with approximately 71% of that specific content arriving uncompressed.

“A small increase in CPU gives Cloudflare petabytes of effective cache capacity and reduces the data transferred between our data centers,” Aashi Patel writes. “The encoding cost is paid once when an asset enters the cache. The storage and bandwidth savings continue every single time that asset is reused.”

Infrastructure Engineering Trade-offs and Industry Discussion

By trading modest origin-facing CPU cycles for massive reductions in edge disk space and inter-datacenter bandwidth transit, the system addresses hard physical constraints in hyperscale CDNs. When edge caches run out of disk space, older assets are evicted early, which forces subsequent requests back to customer origin servers and increases latency.

Cloudflare Tests Cache Transcoding Prototype to Reduce Storage Needs
Photo: world-today-journal.com

The prototype has drawn attention and questions from practitioners on Hacker News. Discussing the compression options and the choice of asset targeting, user MayeulC noted they would have focused on compressing cold content instead to save on CPU time during decode. Another participant, user CodesInChaos, raised questions regarding how the pipeline handles range requests, which are normally satisfied by reading specific parts of a cached complete file.

Frequently Asked Questions

What compression algorithm does Cloudflare use for Cache Transcoding?

Cloudflare uses Zstandard, a lossless compression algorithm developed by Facebook for real-time use, paired with its Rust-based Pingora proxy framework.

Cloudflare Tests Cache Transcoding to Reduce Storage Costs
Photo: brocker.org

Which types of content are targeted by the transcoding pipeline?

According to Cloudflare, the system targets uncompressed text responses that are at least 4 KiB, including HTML, JSON, CSS, and JavaScript. It excludes images, videos, fonts, range requests, and precompressed binaries.

Is the Cache Transcoding prototype deployed globally?

No. Cloudflare’s Cache Transcoding remains an internal prototype under development, with further testing planned across different compression levels, content types, object sizes, and cache scenarios.

Join the Conversation

What are your thoughts on trading CPU overhead for edge storage capacity? Share your perspective in the comments below or subscribe to our newsletter for more infrastructure engineering deep dives.

Leave a Comment