Live data from Hacker News

Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache

blog.cloudflare.com

241–250 of 306 posts

Re: Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache

#241
post #68

This is the right way to deliver software. Produce working product first, validate the idea, stabilize the business, start generating profit, and then you can start optimizing your costs. In fact optimization is by far the easiest part of the process because there are many system programming experts on this HN thread who consider these optimizations to be trivial.

Not the right order if the optimization is a prerequisite for a positive business case. That happens more often than people think...

Re: Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache

#242
post #156

Not sure what they use to hold the cache key and entry. If a hashmap is used, then a radix tree (adaptive radix tree) would be better in saving memory space. Most of content of the qname field of the CacheKey is hostname, like www.site.com. The reverse version com.site.www fits nicely in navigation path of a radix tree. The common prefixes like "com." are shared and compressed in the parent nodes of the tree. Even a…

At this scale, moving from one pointer chase to multiple is almost certainly a huge loss, even if radix tree would save a lot of memory.

Re: Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache

#243
post #234

Earlier quoted context omitted.

Remember that everything has an opportunity cost. Running a lot of servers might cost $10 million annually, but if the product team had to choose between a project that would recoup $5 million of that vs. an opportunity to earn $50 million ARR for the same amount of work, the logical answer would be obvious.

In my experience optimizations actually preformed tend to have ridiculously high ROI because they are so rarely prioritized. Better performance = saving money + better user experience.

Depends on how you measure your ROI and how it could be different from how your company measure their ROI.

The problem with optimizations is that you are competing in prioritization with other features. Reducing the baseline cost always has a limit of zero, while the upside from new features is infinite according to your leadership and investors, so it is very hard to argue against.

In general it's challenging to convince a non-tech crowd of the importance of addressing any tech debt unless you can demonstrate a tangible financial impact on the product, such as delayed contracts or customer churn.

Re: Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache

#244
post #68

This is the right way to deliver software. Produce working product first, validate the idea, stabilize the business, start generating profit, and then you can start optimizing your costs. In fact optimization is by far the easiest part of the process because there are many system programming experts on this HN thread who consider these optimizations to be trivial.

I do not think Cloudflare was a less-than-peers optimized product when they launched. This is one of their blog posts which describes taking one aspect even further. I think Cloudflare became big only because they were so much more optimized than others that they offered some services for free that others were not offering. If running costs are high, you only burn (VC) cash and then you exit.

There is the entirely plausible option of the NSA indirectly bankrolling them to counteract the growing number of TLS connections. We terminate your TLS for free in our server and you don't have to change anything was a sweet deal for website operators _and_ those that want to look at unencrypted traffic. Given enough sustained funding they could undercut competitors and grow to what they are today.

Re: Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache

#245
post #53
post #49

It's weird that it took so long for these trivial optimizations but it might just be that they were working on optimizing other stuff.

this applies to more than DNS caches. In 1998 I mailed Microsoft a proposal to replace search engine crawlers with a push-based filesystem monitor (detect change → extract → compress → push to index). Got a 5-line rejection letter. They built the same thing 20 years later as IndexNow. Full story with the original letter: https://dev.to/andrew_vl/in-1998-i-proposed-push-based-searc...

Sadly it could be a result of xenophobia and discrimination due to your nation of origin. Very common in tech circles. If someone from San Francisco proposes it, it's a glorious idea, if not, it's junk.

Re: Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache

#247
post #206

Earlier quoted context omitted.

Its a yes if you do not know the domain space, query patterns well enough and also if the cost of optimization or time for optimization may have detrimental impact to business. In this case it most likely means that the crowd in the room did not anticipate much on this in early phases and no one in the room pointed these things out. The irony is that these performance and disk numbers are heavily discussed as a part…

> This is a misconception Pretty sure they were joking.

For anything you do, no matter how novel and difficult, someone on HN will tell you it’s trivial and done since the 70s.

Re: Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache

#248

Why do people seem to think that optimization is something you only have to deal with once the software scales so much that 100s of TB of memory or disk space (or thousands of hours of processing time) are being wasted. It is almost like nobody even thought during the design phase about what might happen down the road. This is why so much software is bloated and often buggy. Just gets something that half-way works ou…

I recently heard a great analogy for this exact problem under the premise of "Make it work, make it right, make it fast". Assume a sorting algorithm as a metaphor for your whole program. You make it work by implementing the simplest thing you know how to write: bubble sort. Works. At the end you notice it's way too slow and replace with something much better: quicksort. Now, how much of your program is surviving? Alm…

You could have picked a better example, sorting algorithms are typically drop-in replacements.

Re: Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache

#249
post #243
post #234

Earlier quoted context omitted.

In my experience optimizations actually preformed tend to have ridiculously high ROI because they are so rarely prioritized. Better performance = saving money + better user experience.

Depends on how you measure your ROI and how it could be different from how your company measure their ROI. The problem with optimizations is that you are competing in prioritization with other features. Reducing the baseline cost always has a limit of zero, while the upside from new features is infinite according to your leadership and investors, so it is very hard to argue against. In general it's challenging to con…

> The problem with optimizations is that you are competing in prioritization with other features.

I think companies often over-indulge in features nobody wants, needs, or cares about. I quit my previous company because they were forcing us to build something that had single digit weekly active users. It was utterly pointless, driven entirely by some half baked navel gazing harebrained ideas about what a "nontechnical user" might want. But nobody ever asked any real users.

I estimate the company probably blew the greater part of $10M on this bullshit, not counting opportunity cost.

> In general it's challenging to convince a non-tech crowd of the importance of addressing any tech debt unless you can demonstrate a tangible financial impact on the product, such as delayed contracts or customer churn.

People like that are problematic not just because they don't understand tech debt. They also don't understand products. There are shitloads of people in the industry who market themselves as some kind of mystical gurus, are able to deliver impressive monologues talking over everyone on the zoom call, but contribute nothing else than a sense of urgency and frustration. If you find yourself in their company, better to just leave.

Re: Saving 100 terabytes of memory by optimizing 1.1.1.1's DNS cache

#250
post #201

I wonder at their scale, why wouldn’t it make sense to store the entries lightly compressed in memory?

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

Ah yes, something like prefix tree would work well storing reverse domain names like com.abc.www (although this is such a well known thing I feel like I must be missing things).
Post reply on HN