Technology
Cloudflare tests internal cache compression prototype using Zstandard and Pingora
A prototype system dubbed Cache Transcoding compresses text assets before writing them to disk, aiming to save petabytes of storage.
The short version
- Cloudflare engineered a prototype called Cache Transcoding to compress eligible text cache items using Zstandard level 3 inside its Pingora proxy.
- Testing showed compressed text assets were reduced to about one-third of their uncompressed size, achieving an average 2.834x compression ratio.
- The system trades a slight increase in processing overhead for significant reductions in disk use and cross-data center network traffic.
- Engineers plan to test higher compression levels and evaluate broader real-world data before deploying the design fleet-wide.
Key facts
- The prototype targets uncompressed HTTP 200 responses of compressible text types (HTML, JSON, CSS, JavaScript) that are at least 4 KiB in size.[Hacker News]
- Initial testing on eligible test assets demonstrated an average compression ratio of 2.834x, reducing data to roughly one-third of original disk space.[Hacker News]
- The implementation recorded an encoding cost of 4.31 nanoseconds per byte (around 232 MB/s) on cache fill and a decode cost of 1.56 nanoseconds per byte (around 641 MB/s) per client serve.[Hacker News]
- The architecture keeps files compressed during transfers between Cloudflare data centers via Tiered Cache, decoding only before serving responses to clients.[Hacker News]
What remains uncertain
- Cloudflare noted that the test corpus does not represent all internet traffic and that broader validation across varied content types and sizes is needed before treating the compression ratio as a fleet-wide constant.[Hacker News]