How Cloudflare trimmed 100TB of RAM from its DNS cache

How Cloudflare trimmed 100TB of RAM from its DNS cache

Cloudflare freed up 100 terabytes of RAM across its global network by redesigning how its DNS cache stores data.

Cloudflare's Big Pineapple platform powers 1.1.1.1 and holds over 250 billion cache entries at any given time. In a engineering writeup, Cloudflare detailed five data-structure tweaks to its Rust codebase that cut the memory footprint of each cache entry by over 50%.

Why it matters: At 250 billion entries, wasting one byte per record burns 250 gigabytes of memory worldwide. The team swapped dynamic buffers for fixed-size slices and merged lists to drop overhead. The cache got faster too: insert throughput rose 43% and lookup latency dropped 19% thanks to fewer allocations.

Know this: The 100 terabytes saved equals the total RAM across 130 of Cloudflare's Gen 13 servers.

Proof that sometimes the best server upgrade is just trimming unused struct fields.

Sources