Cloudflare has redesigned the in-memory representation of the DNS cache used by its 1.1.1.1 resolver, reducing the benchmarked per-entry footprint by 56% and freeing roughly 100 TB of working-set memory across its fleet. The changes to Big Pineapple, Cloudflare's DNS platform, also increased cache insertion throughput by 43% and reduced lookup latency by 19%.
Big Pineapple stores more than 250 billion DNS cache entries at any given time. Cloudflare systems engineer Sebastiaan Neuteboom described the result on LinkedIn as,
It's not every day you get to save 100 terabytes of memory.
The work involved five successive changes to cache representation in Rust. Cloudflare replaced Vec and String with Box<[T]> and Box<str> for data fixed after insertion, saving 64 bytes per entry and more than 15 TB fleetwide. It then combined answer, authority, and additional records into one list with compact offsets, packed Booleans into bitflags, and omitted owner names matching the queried domain, reconstructing them from the cache key. The largest challenge involved Rust enums: Cloudflare initially boxed larger variants, but separate allocations added overhead and reduced memory locality.
One Reddit commenter summarized the tradeoff:
A lot of these memory tricks only pay off once you're at Cloudflare's request volume; at a smaller scale the extra indirection from boxing variants can actually hurt cache locality more than it helps.
Cloudflare's final design stores record data in a contiguous byte buffer using DNS wire format. This removes the enum and per-record allocation overhead while improving locality. Frequently used record types can also be copied directly into responses, while records containing domain names still require parsing for DNS name compression.

Cloudflare's DNS cache stores record data as a contiguous byte buffer using DNS wire format (Source: Cloudflare Blog Post)
The approach differs from cache architectures used by other recursive DNS resolvers. Unbound, for example, maintains separate message, RRset, key, and negative caches with configurable cache sizes and slab settings, while PowerDNS Recursor uses multiple cache types, including packet and record caches. Cloudflare's work instead focuses on reducing representation and allocation overhead within individual cache entries.
The optimization was rolled out across production between May 18 and July 6, 2026. At p99, resident memory per instance fell from 9.3 GB to 5.3 GB, while p90 memory declined from 6.5 GB to 3.8 GB.

Cloudflare's production memory usage graph (Source: Cloudflare Blog Post)
Benchmarks showed the per-entry footprint falling from 953 to 420 bytes and allocations from 1.1 KB to 461 bytes. Insertion throughput rose 43%, and lookup latency fell 19%. Across the fleet, the changes freed roughly 100 TB of working-set memory, which Cloudflare plans to use to increase cache capacity without increasing overall memory consumption.