| Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache(blog.cloudflare.com) | |
| 904 points by TangerineDream 13 days ago | 280 comments | |
tl;dr: Cloudflare cut per-entry memory in 1.1.1.1's DNS cache by 56% (from 953 to 420 bytes) through five Rust-level optimizations: replacing `Vec`/`String` with `Box<[T]>`/`Box<str>`, merging record sections with offsets, dropping redundant owner names, boxing large enum variants, and storing record data in raw wire format. Across the fleet this freed ~100TB of RAM, while also boosting insert throughput 43% and cutting lookup latency 19% thanks to better memory locality and fewer allocations. | |
HN Discussion:
| |