r/programming • u/Ok_Stomach6651 • Aug 27 '26
How we saved 100 terabytes of memory by optimizing 1.1.1.1’s DNS cache
https://blog.cloudflare.com/dns-cache-memory-optimization-1111/
2.1k
Upvotes
r/programming • u/Ok_Stomach6651 • Aug 27 '26
572
u/hypertesto Aug 27 '26
I always enjoy this kind of posts from Cloudflare.
Boxing the enum variants it's something I'd never taught about
122
u/KryptosFR Aug 27 '26
That was an interesting read. Easy to understand even if you don't know what DNS records are.
24
u/Pseudanonymius Aug 27 '26
Very interesting. Would love to be one of the people working on it, amazing Engineering.
35
u/BoredTech127001 Aug 28 '26
So I'm hearing you have some memory for sale then... I'm interested.
21
u/authentic_developer Aug 28 '26
Neat writeup. Worth flagging that a lot of these memory tricks only pay off once you're at Cloudflare's request volume, at a smaller scale the extra indirection from boxing variants can actually hurt cache locality more than it helps. Profiled something similar once on a much smaller cache and the "obvious" optimization made things slower until the working set got big enough to matter.
7
u/ExF-Altrue Aug 28 '26
A clean and interesting read as always!
7
u/HRApprovedUsername Aug 28 '26
Who’s paying for all the bots in this comment section
18
u/DeliciousIncident Aug 28 '26
The guy who used DNS as free storage must be furious now with his data being gone!
13
u/Zamaamiro Aug 28 '26
Cloudflare has some of the best engineers in the business.
2
u/Roang_zero1 Aug 28 '26
Good read. The savings are incredible at all levels, but this really highlights how small savings can have a massive impact at scale.
2
u/r1shi Aug 28 '26
Boom Boom Sebastiaan! nice article.
2
u/Revolutionary_Ad7262 Aug 29 '26
I would like to see x32 ABI in action for it or some slot based pointers, which are independent of the machine word
3
u/smp46 Aug 28 '26
Cloudflare blogs are always interesting, cool that they're still finding ways to optimise an older service.
-1
u/Rare_Instance_8205 Aug 28 '26
Hi, as someone new to programming can anyone please tell me what should I need to learn before I fully understand this article and start thinking like these guys did?
-6
u/NamedBird Aug 28 '26
Neat article.
(Though i think we need a DNS 2.0 or something to really make it more efficient.)
501
u/[deleted] Aug 27 '26
[removed] — view removed comment