
How we saved 100 terabytes of memory by optimizing 1.1.1.1’s DNS cache
Cloudflare implemented five memory storage optimizations for its Big Pineapple DNS platform to reduce the per-entry memory footprint. These changes significantly lowered resident memory usage while increasing cache performance.
Why it matters
These efficiencies reduce the hardware resources required to operate DNS services and lower lookup latency for users.
The details
Cloudflare replaced Vec and String types with Box types to eliminate unused capacity fields and combined record lists into a single list using 2-byte offsets. They also stopped storing record owner names when identical to the queried domain and moved record data into a contiguous raw byte buffer to improve CPU cache locality.
What's next
Cloudflare plans to reinvest the freed memory to increase cache capacity, aiming to improve hit rates and reduce upstream query volume.
Get the weekly recap
The stories like this one, picked and explained — once a week, straight to your inbox.