Hacker News
Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache
Big Pineapple’s DNS cache holds over 250 billion entries, and five successive memory-layout changes reduced the per-entry footprint by more than 50%, freeing roughly 100 TB of RAM across the fleet. The optimizations—replacing growable vectors with fixed-size boxes, eliminating unused fields, and tightening type representations—also boosted insert throughput 43% and cut lookup latency 19%, especially benefiting ECS-heavy locations.