Live data from Hacker News

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

blog.cloudflare.com

111–120 of 305 posts

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

#111
post #82
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.

This reasoning assumes you have access to infinite runway. You don't.

[deleted]

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

#112

Earlier quoted context omitted.

Or optimize a bit earlier and prevent having to scale out to a bazillion systems.

The way I usually prevent having to scale out to a bazillion systems is never getting more than 10 users.

The art of premature optimizations

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

#113
post #57
post #27

Earlier quoted context omitted.

System programming always matters. Things are cheap until they aren't one day.

things are cheap until you reach a scale.

Things are cheap until they are someone else’s problem, I say!

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

#116
post #42
post #20

Earlier quoted context omitted.

It only looks super obvious in hindsight and the well explained blog post. when a team of 5 is tasked with getting a completely new DNS up at the scale and integrate well with cloudflare. if you spend cycles on nitty gritty opinions like this time to market goes out further and further out. some napkin math, 130 gen13 servers cost "only" ~$2.6M. relative to the importance of the 1.1.1.1 and the market at the time. th…

This one also looks pretty obvious "in foresight" (using the same tools that existed back then. Maybe owner dedupe might be less obvious and require a bit of knowledge and probing into actual data, but for rw vs ro you are fine knowing nothing?) and you forgot the napkin math re. how much your precious "time to market" would have been delayed by. It's also not nothing, otherwise it would never be optimized away now,…

Imagine you're an engineer at cloudflare, an 8 year old (at the time of launch of 1.1.1.1) company. The company is wildly popular and any service launched is going to have a lot of traffic and a lot of attacks right away. Any problems with it are going to embarass the company a lot.

You're tasked with making a DNS caching recursive resolver that can operate at a large scale and will be run on thousands of servers each of which has a lot of GBs of ram.

You are given some period of time to build this and make it production ready. How do you spend your time:

* Focusing on making sure that the resolver works correctly?

* Focusing on make sure that it actually provides improved DNS performance for internet users?

* Handles an very large number of record requests/s?

* Saves a few GB of ram per server?

There are tradeoffs to consider. RAM is cheap, even at today's prices RAM is not the most expensive thing that can go wrong in such a scenario. Having the responses be slow or incorrect is a far more expensive problem. A good engineer would pick a simple data structure that has the right shape but might not be optimal in footprint to focus on correctness and response time. The few extra GBs of RAM per server can be dealt with later.

When building things at scale you want to make sure it works correctly, fails correctly, and does the thing quickly before worrying about reducing resource consumption. I've never seen a project fail on Vec vs Box memory differeneces, or even on a few GBs of RAM usage per instance. I have seen them fail on "one wierd corner case of correctness" though, and on poorly thought through failure modes.

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

#117
post #4

This is why system programming still matters. Looks like they're missing the obvious optimisation of putting the record data right after the CacheEntry members instead of allocating memory separately though. But that might just be me as a C-programmer talking and not be all that easy in Rust.

I wish more programming languages implemented record types as seen in databases, where dynamically sized fields are packed into a contiguous area of memory.

The CloudFlare manually implemented a clumsy version of this.

Wouldn’t it be nice for the compiler to manage this for you in the same way that your database engine does when it saves a “row”?

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

#119
post #95
post #82

Earlier quoted context omitted.

This reasoning assumes you have access to infinite runway. You don't.

Every startup is one bet in a Martingale strategy played by the class of people who remain solvent when you bust.

The median return for a startup is $0. Take care when trying to extrapolate cause and effect.

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

#120
post #82
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.

This reasoning assumes you have access to infinite runway. You don't.

This reasoning is largely centered around the runway being finite. You obviously can't have costs so high you are making a huge loss, but also there's little value in improving margins past profitability until you actually have a stable segment of the market.
Post reply on HN