Hacker News
Cloudflare Cut 1.1.1.1's DNS Cache Entry From 953 Bytes to 420 and Freed About 100 Terabytes of Fleet Memory
The August 27 post walks through five Rust-level changes: swapping Vec/String for Box<[T]>/Box<str> to drop capacity fields (64 bytes per entry), merging answer, authority and additional sections into one list with u16 offsets (28 bytes), making record owners Option<Box<Name>>, boxing large RecordData variants to stop 144-byte padding waste on A records (120+ bytes per record), and storing record data as raw wire-format bytes. Per-entry allocation fell from 1.1 KB to 461 bytes, insert throughput rose 43% from 625K to 893K entries per second, lookup latency dropped 19% from 828 ns to 670 ns, and production p99 memory went from 9.3 GB to 5.3 GB, freeing memory equivalent to 130 servers.
↳ Follow the thread