Cloudflare has freed up roughly 100 terabytes of RAM across its global server fleet by redesigning the memory layout of its DNS cache entries, specifically for the 1.1.1.1 DNS resolver.
One Byte Costs 250 Gigabytes
The lever is sheer scale: Cloudflare holds more than 250 billion DNS entries in cache at any given time. So even a single wasted byte per entry costs over 250 gigabytes of fleet memory. Five Rust-level optimizations cut the memory footprint per entry by 56 percent.
Fixed Slices Instead of Growable Containers
- Replacing Rust’s growable Vec and String containers with fixed-size boxed slices saves over 15 TB on its own.
- The three record lists in every DNS response are collapsed into one buffer, addressed via 2-byte offsets.
- Record data is stored as length-prefixed raw bytes in wire format.
Faster, Not Slower
The savings did not come at the cost of speed. Thanks to fewer allocations and better memory locality, insert throughput rose 43 percent while lookup latency dropped 19 percent.
Quellen: Golem.de.



















