Top
Best
New

Posted by TangerineDream 13 hours ago

Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache(blog.cloudflare.com)
646 points | 197 commentspage 3
superze 7 hours ago|
How much is this in euro or do we measure money in ram now?
inigyou 4 hours ago|
Currently $15 per GB, he saved Cloudflare $1,500,000 and got exactly $0 bonus. He must really believe in cloudflare's vision (global enshittification). In related news, three times today Cloudflare told me that I'm a bot and shall not pass - not that it needs to check if I'm a bot before it lets me pass.
winrid 2 hours ago||
I saved an employer $4m/yr, entirely myself. I think I got a 10k bonus.
cristaloleg 9 hours ago||
Obvious question: why wasn’t this done earlier? It looks like all the data was already available. At THAT scale, reducing memory usage is a must-have, not a nice-to-have. Weird.
sophacles 9 hours ago||
Cloudflare talks about having datacenters in 300+ cities. Presumably they have at least a few servers per datacenter. They saved 130 servers worth of memory... not even the minimum number of servers they have (seriously though, they probably have a LOT of servers)... a few GBs of memory per server running the service. At that scale this is a nice-to-have.
yieldcrv 9 hours ago||
probably agents going through tech debt or finding wins

every dept knows what they could do with more budget, the budget for those things just never comes

now agents have utilized budget more effeftively, unbottlenecking many things, including engineering blogs

makach 1 hour ago||
this is so interesting, memory and storage is cheap until it isn't and then you optimize.
OptionOfT 12 hours ago||
> we store the records as a single Box<[u8]> containing each record encoded as a 2-byte length prefix followed by its raw bytes.

Interestingly this is exactly how netlink works-ish: https://manpages.ubuntu.com/manpages/focal/man3/netlink.3.ht...

You start, get the type & length, and then that is how many bytes you read.

Some issues with that when you deserialize, from a raw stream in to `[u8; 4096]` buffer, the alignment is only guaranteed to be on 1 byte, not 4 bytes.

In practice it is 4 bytes, but if you run those tests with Miri, you'll get yelled at. So the fix there is to declare the buffer with a type that mandates the alignment of the largest type that you're going to be deserializing.

So then you start your buffer as follows: `[u32; 1024]`, and with `slice::from_raw_parts` you get to turn that into `[u8; 4096]` with the expected alignment.

As an exercise I wrote a streaming parser for netlink, the current existing package serializes everything, all at once.

jandrewrogers 7 hours ago||
This kind of encoding[0] is ubiquitous in networking protocols. It scales down to small silicon well and enables the receiver to estimate resource requirements or skip parts of a serial byte stream without storing it in memory first. These encodings usually aren't aligned by design.

[0] https://en.wikipedia.org/wiki/Type–length–value

pocksuppet 9 hours ago||
It's called TLV encoding - tag/length/value. It's very common in all sorts of network protocols and serialisation formats. It allows you to skip unidentified tags. Sometimes, like in the PNG file format, there's a fixed bit in the tag that tells you whether it's safe to skip or if you have to reject the whole thing because you don't understand this tag.

Hey dang can I get my rate limit turned off pretty please?

NahImG 1 hour ago||
sees cloudflare

leaves

squirrellous 6 hours ago||
I wonder at their scale, why wouldn’t it make sense to store the entries lightly compressed in memory?
winrid 2 hours ago|
Yeah with snappy they probably could get like 30% savings (I bet domains don't compress well) without much more cpu usage.

Alternatively a btree somehow they can take advantage of prefix compression

dshat 12 hours ago||
I'll buys some spare RAM you now have. I only need 64GB.
mu54 8 hours ago||
The Art of Production.
varispeed 9 hours ago||
Now put the 100 terabytes of memory back to the market. Stop hoarding RAM.
HDBaseT 6 hours ago|
DNS is important and 100TB of RAM is effectively nothing.
gxdbox 1 hour ago|
[flagged]
More comments...