Cloudflare’s 1.1.1.1 DNS resolver and related services rely on a platform called Big Pineapple to cache over 250 billion DNS entries globally. At that scale, small inefficiencies in memory usage compound quickly. A series of five optimizations to the cache’s Rust implementation reduced the per-entry memory footprint by more than half, freeing roughly 100 terabytes of RAM across Cloudflare’s fleet without sacrificing performance—in fact, both speed and efficiency improved as a result.
How the optimizations worked
The cache stores DNS responses as structured data, with each entry containing the query details and the response records. Early versions used standard Rust types like Vec<T> and String, which include capacity fields and heap allocations that are unnecessary once the data is written to the cache. By replacing these with fixed-size alternatives like Box<[T]> and Box<str>, Cloudflare eliminated 64 bytes of overhead per entry. This change alone saved over 15 terabytes of memory across the fleet.
Further savings came from consolidating the three record sections (answer, authority, and additional) into a single list with offsets. Instead of storing three separate lists—each requiring an 8-byte pointer and length—Cloudflare used 2-byte offsets, reducing the per-entry cost by 28 bytes. Additional tweaks, such as packing boolean fields into bitflags and removing redundant owner names from DNS records, shrank the structs further by eliminating padding.
The largest records, like NAPTR, previously forced all enum variants to allocate space for the largest possible size, wasting memory for common record types like A and AAAA. Boxing the larger variants moved them to the heap, reducing the inline size of the enum from 144 bytes to 24 bytes for most records. While this introduced some allocator overhead, the tradeoff was justified by the rarity of large record types in production traffic.
The final optimization stored record data in raw wire format, encoded as a single byte buffer. This eliminated per-variant enum overhead and improved CPU cache locality by packing data contiguously. Records that don’t require name compression (like A, AAAA, and DNSSEC) can now be copied directly into responses, reducing serialization work during lookups.
Impact on performance and capacity
The rollout began on May 18, 2026, and completed across all services by July 6, 2026. Production measurements showed steady-state memory usage dropped by 42-43% across percentiles. At the 99th percentile, resident memory per instance fell from 9.3 GB to 5.3 GB. Aggregate fleet memory savings totaled approximately 100 terabytes, equivalent to the RAM in 130 of Cloudflare’s Gen 13 servers.
Performance metrics improved alongside memory efficiency. Cache insert throughput increased by 43%, from 625,000 to 893,000 entries per second. Lookup latency decreased by 19%, from 828 nanoseconds to 670 nanoseconds. The optimizations also reduced per-entry allocations from 1.1 KB to 461 bytes, a 58% reduction.
- Per-entry memory footprint: 953 bytes → 420 bytes (-56%)
- Per-entry allocations: 1.1 KB → 461 bytes (-58%)
- Cache insert throughput: +43% (625K → 893K entries/s)
- Lookup latency: -19% (828 ns → 670 ns)
- Fleet-wide memory savings: ~100 TB
Cloudflare plans to reinvest the freed memory into expanding cache capacity, which should improve hit rates and reduce upstream queries. The company is also exploring additional optimizations, such as further refinements to the cache’s data structures.
Why this matters for DNS operators
The optimizations demonstrate how low-level changes to data structures can yield significant resource savings at scale. For operators running large DNS resolvers, the techniques—such as replacing Vec<T> with Box<[T]>, boxing enum variants, and storing data in wire format—are broadly applicable. The improvements in memory locality and reduced allocations also highlight the importance of benchmarking performance tradeoffs, as some changes (like boxing) introduced overhead that was later mitigated by alternative approaches.
For professionals: The memory savings can be repurposed to increase cache size without additional hardware, improving hit rates and reducing latency for end users. Operators should audit their own DNS cache implementations for similar inefficiencies, particularly in how records are stored and serialized.
Companies mentioned
Automated pipeline · Domains
Synthesized from 1 industry feed on 27 Aug 2026. Passed independent editor verification (score 95/100) before publication. Style guide v1.4.
Sources
Decision trail
- Checking for duplicates — New story No prior coverage of Cloudflare's DNS cache optimization improvements.
- Checking for duplicates — New story pre_write:; No recent or in-pipeline article covers Cloudflare's DNS cache memory optimization.
- Writing the article — Draft created article_id=475 slug=cloudflare-cuts-1-1-1-1-dns-cache-memory-by-100-tb
-
Editor review — Approved
- Score: 95/100
- Factual grounding: The draft states the rollout began on 'May 18, 2026' and completed by 'July 6, 2026'. The source confirms these exact dates, but the draft does not explicitly note that these dates are from 2026. While the reference date is 2026 and the source was published in 2026, the year should be included in the body for clarity to avoid ambiguity for future readers.
- Style compliance: The draft uses a 'Key facts' block with bullet points, which is allowed, but the block includes 'Per-entry allocations: 1.1 KB → 461 bytes (-58%)'. The source uses '1.1 KB' and '461 bytes' in the same metric, which is inconsistent. Standardize to bytes or KB for uniformity.
- No copied phrasing: The draft closely mirrors the source's phrasing in the 'How the optimizations worked' section, particularly in describing the enum sizing and boxing optimizations. While the facts are correct, the structure and wording are too similar to the source. Restructure these sections further to avoid echoing the source.
- Generating reader Q&A — Generated 5 items
- Assigning hero image — Rejected library image #1: The candidate depicts a masked person manipulating a server in a data center, which is unrelated to the article's focus on Cloudflare's DNS cache memory optimization. The alt text mentions 'oracle peoplesoft server security breach data theft,' which is entirely off-topic for a DNS and Rust optimization news piece.
- Assigning hero image — Rejected library image #140: The candidate depicts Cloudflare headquarters, which is unrelated to the article's focus on DNS cache memory optimization. The alt text is also incorrect (mentions GoDaddy), and the image does not illustrate the technical topic of DNS or memory efficiency.
- Assigning hero image — Reused library image unsplash_id=yqaskj8lQBE q=memory optimization benchmark graph picker=The article discusses Cloudflare's DNS cache memory optimization, and candidate 32 (a bar chart on a computer screen) di
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 403 candidates
- Linking related stories — Linked 3 relations from 404 candidates
- Linking related stories — Linked 3 relations from 404 candidates
- Linking related stories — Linked 3 relations from 405 candidates
- Linking related stories — Linked 3 relations from 406 candidates
- Linking related stories — Linked 3 relations from 407 candidates
- Linking related stories — Linked 3 relations from 407 candidates
- Linking related stories — Linked 3 relations from 408 candidates
- Linking related stories — Linked 3 relations from 409 candidates
- Publishing — Published cloudflare-cuts-1-1-1-1-dns-cache-memory-by-100-tb
- Mastodon — Posted https://mstdn.social/@hostingpaper/117172874898524554




Discussion · coming soon
Be the first to join the thread when community discussion launches.