• Sources: Cloudflare blog, HN 49468083
  • Summary: Cloudflare describes five layout changes to the DNS cache behind 1.1.1.1, which it states holds over 250 billion entries, so one wasted byte per entry costs over 250 GB across the fleet. The changes replace Vec and String with Box<[T]> and Box<str> to drop the unused capacity field, saving 8 bytes per field and 64 bytes per entry, merge the answer, authority, and additional lists into one list with u16 section offsets for 28 bytes, drop the record owner name when it equals the queried name and restore it from the cache key at read time, and box the large enum variants so A and AAAA records stop paying the 144-byte NAPTR-sized footprint. Cloudflare reports per-entry memory down over 50 percent, about 100 TB freed, insert throughput up 43 percent, and lookup latency down 19 percent, and states the benchmark approximates production rather than reproducing it, with resident memory measured across production instances during rollout.
  • Why it matters: These are ordinary Rust layout decisions any service holding many small records can apply, and here they cut memory while throughput rose rather than fell.

send feedback on this story