Five Rust Changes, 100 Terabytes of RAM
Cloudflare cut its 1.1.1.1 DNS cache in half with five small Rust changes, freeing roughly 100 terabytes of RAM across the fleet.
Big Pineapple, the platform behind 1.1.1.1, holds more than 250 billion DNS cache entries at any given moment. At that scale, one wasted byte per entry costs more than 250 gigabytes of RAM across the fleet.
Five small changes to how those entries are stored cut the per-entry footprint by more than half and freed roughly 100 terabytes of RAM — the contents of 130 of Cloudflare’s Gen 13 servers. The cache also got faster: insert throughput up 43 percent, lookup latency down 19 percent.
The savings are unglamorous: drop the 8-byte capacity field from every fixed list, merge three section lists into one with 2-byte offsets, stop storing the owner name when it matches the queried domain. Each change is tiny. The list change alone is worth more than 15 terabytes, and I would have missed all three in a code review.
If the bitap article taught you to love clever bit tricks, this is the opposite: unglamorous byte-accounting that actually moves a fleet. Worth your time if you are shrinking a hot data structure — the owner-inference trick alone is worth stealing.