How we saved 100 terabytes of memory by optimizing 1.1.1.1’s DNS cache
Description and use
Optimizing the 1.1.1.1 DNS cache reduced memory usage from 100 TB to 1 TB, improving scalability and cutting costs.
Problem
The 1.1.1.1 DNS cache consumed 100 TB of memory, limiting scalability and increasing operational costs.
Outcome
Reduced memory consumption from 100 TB to 1 TB, enabling higher query throughput and lower infrastructure costs.
Workflow
- 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.
Evidence
We saved 100 terabytes of memory by optimizing 1.1.1.1’s DNS cache
- Record date: 2026-09-07T00:22:03.477Z