Cloudflare frees 100 TB RAM with five DNS cache optimizations
Cloudflare announced five specific software optimizations for its Big Pineapple platform that collectively freed approximately 100 TB of RAM across its global infrastructure. These changes, implemented in Rust and rolled out between May and July 2026, reduced the memory footprint per DNS cache entry by roughly 56% while simultaneously improving performance metrics such as lookup latency and insertion rates.
The core issue addressed was inefficient memory allocation within data structures used to store DNS records. Previously, mutable types like Vec<T> and String reserved extra capacity even when the stored data was static. Cloudflare replaced these with fixed-size variants such as Box<[T]> and Box<str>. This single change alone saved 64 bytes per entry, translating to over 15 TB of freed memory across the entire fleet of more than 250 billion cached entries.
A second major optimization involved consolidating separate lists for Answer, Authority, and Additional DNS sections. Instead of managing each section with independent pointers and lengths, Cloudflare merged them into a single list using small offsets. This structural change reduced the memory required per entry from 953 bytes to 420 bytes.
The team also eliminated redundant information in DNS records. In many cases, the record owner name was identical to the queried domain. Rather than storing this name fully for every entry, Cloudflare modified the logic to reconstruct it from the cache key when necessary. Additionally, they optimized Rust enum layouts. Enums must reserve space for their largest possible variant, which previously caused small records like IPv4 A-records (4 bytes) or IPv6 AAAA-records (16 bytes) to waste over 120 bytes due to padding and pointer overhead.
To fix this, Cloudflare initially moved larger variants to the heap via pointers. They later advanced further by storing record data directly in a contiguous byte buffer matching the DNS wire format. This denser layout improved CPU cache locality and allowed records to be copied directly during response generation, eliminating the need for field-by-field serialization.
The results of these optimizations are significant. Benchmarks show that cache insert rates increased from 625,000 to 893,000 entries per second, a 43% improvement. Lookup latency dropped from 828 nanoseconds to 670 nanoseconds, a 19% reduction. The resident memory consumption for a single Big Pineapple instance fell from 9.3 GB to 5.3 GB. Across the entire infrastructure, the working set reduced by approximately 100 TB.
Cloudflare compares this freed memory volume to the RAM of roughly 130 Gen-13 servers. Rather than leaving this capacity idle, the company plans to use it to increase overall cache size. Larger caches will retain more DNS answers locally, reducing the need to forward requests to authoritative DNS servers and further improving user experience for services like 1.1.1.1, Gateway DNS, and DNS Firewall.
The rollout began on May 18, 2026, and was completed across all affected services by July 6, 2026. The data published on August 27 reflects measurements from the production environment rather than just synthetic benchmarks, confirming that these software-level upgrades deliver tangible efficiency gains without sacrificing speed.