started · updated
Cloudflare reclaims 100TB of memory via DNS cache optimization
Cloudflare has successfully reclaimed approximately 100 terabytes of memory across its global infrastructure by optimizing the DNS cache for its 1.1.1.1 service. The optimization targeted the Big Pineapple platform, which manages over 250 billion DNS cache entries at any given time. By reducing the memory footprint of each individual entry from 953 bytes to 420 bytes, the company achieved a 56% reduction in per-entry usage.
The technical improvements involved five specific low-level changes implemented in the Rust programming language. These included replacing growable containers with fixed-size types to eliminate unused capacity, consolidating DNS response sections into a single buffer, and removing redundant domain name storage. Additionally, the team restructured how different record types are stored, ensuring that common, smaller records like A and AAAA do not consume the same memory as larger, rarer types.
Beyond memory savings, the optimizations improved system performance. Cloudflare reported a 43% increase in insert throughput and a 19% reduction in lookup latency. The reclaimed memory is equivalent to the RAM found in 130 of the company’s Gen 13 servers.
Entities
1.1.1.1 · Big Pineapple · Cloudflare · Rust