DigiNews

Tech Watch by Johan Denoyer

← Back to articles

How we saved 100 terabytes of memory by optimizing 1.1.1.1’s DNS cache

Quality: 9/10 Relevance: 9/10

Summary

Cloudflare explains how it saved 100 TB of memory in its 1.1.1.1 DNS cache by a series of memory-layout and data-structure optimizations. The changes reduce per-entry footprint by over 50%, from 953 bytes to 420 bytes, and cut allocations, while boosting insert throughput by 43% and decreasing lookup latency by 19%. The post also details moving from Vec and String to Box<[T]> and Box<str>, storing record data in a compact wire-format buffer, and other strategies to improve memory locality and performance.

🚀 Service construit par Johan Denoyer