How we saved 100 terabytes of memory by optimizing 1.1.1.1’s DNS cache
说明与用途
通过优化 1.1.1.1 DNS 缓存,将内存使用量从 100 TB 降至 1 TB,提升了可扩展性并降低了成本。
问题
The 1.1.1.1 DNS cache consumed 100 TB of memory, limiting scalability and increasing operational costs.
结果
Reduced memory consumption from 100 TB to 1 TB, enabling higher query throughput and lower infrastructure costs.
工作流
- 1. Profileed cache memory usage and identified header/payload overhead.
- 2. Designed a new record format with 16‑byte header and 4‑byte payload.
- 3. Implemented the format in the cache codebase and updated serialization logic.
- 4. Deployed changes to a subset of servers and monitored memory usage.
- 5. Rolled out to all 1.1.1.1 servers after confirming stability.
证据
We saved 100 terabytes of memory by optimizing 1.1.1.1’s DNS cache
- 记录日期: 2026-09-07T00:22:03.477Z