Cloudflare frees 100 TB of RAM by slimming its 1.1.1.1 DNS cache
Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache

Cloudflare's Big Pineapple platform stores over 250 billion DNS cache entries at any given time. By making five successive changes to how cache entries are stored in memory, the company cut the per-entry footprint by over 50%, freeing roughly 100 terabytes of memory across its fleet—equivalent to the RAM in 130 Gen 13 servers. The optimizations also improved performance: insert throughput rose 43% and lookup latency dropped 19%. The changes include replacing Vec with Box<[T]>, consolidating record sections, dropping redundant owner names, boxing large enum variants, and storing records in wire format.
At that scale, wasting a single byte per entry costs more than 250 gigabytes of memory across our fleet.