Saving another 100TB of RAM (blog.cloudflare.com)
zer0x4d 9 hours ago
jfengel 8 hours ago
switchbak 7 hours ago
But costs on the cloud are real too, especially now. I’ve been living in JVM land for a very long time, but now it’s especially clear how important lean services are. Especially now that the bar for writing lean code is so much lower: let the borrow checker figure it out, etc.
I just spent a couple days wringing out more performance/memory efficiency for our services. Nice gains to be sure, but it’s still so immensely wasteful compared to something well written running native. If it was my money, I’d be going native for sure.
appreciatorBus 7 hours ago
Some of us find production and optimization more interesting than marketing and distribution.
rstat1 6 hours ago
CookieCrisp 6 hours ago
solarengineer 5 hours ago
The problem statement is of applications using up expensive RAM. Incidentally, expensive RAM is just one of the problems we face in the computing space. Forced obsolescence is another, when running hardware needs to be replaced because software is built for only newer CPUs.
anonzzzies 2 hours ago
You are right, but it reads (to me, could be just me) you mean newer specs which used to be true when I shipped software in the 70-90s; you mean faster machines / more memory right? Like installing a new version of software or OS and suddenly all memory is used, system is swapping and you did not ask for that but some obscure feature you didn't need needed to be shipped fast.
altmanaltman 3 hours ago
dns_snek 40 minutes ago
latexr 6 minutes ago
— Humanity has been on the decline. People are hateful towards each other, striking their fellow man and poisoning the environment. Despots eventually launched nukes which killed everyone but the cockroaches.
— And yet the world still turned.
suriyaG 6 hours ago
anigbrowl 6 hours ago
necovek 2 hours ago
vlovich123 6 hours ago
You use the first N bits of your key hash to pick the server partition so it’s a reasonable number (eg 128 servers per partition). Then use high quality precomputed hashes (first 64 bits of sha256) for the server name as N in H(K + N). Use wymum from wyhash as the H so that you do o(n) integer multiplications while retaining a result that’s still a good hash statistically.
Now you’re using a tournament hash, the small N means O(N) vs O(N log N) doesn’t matter, and also this O(N) is also going to be much less CPU than computing 160 hashes per key as they do now, so much less latency added per request.
MakersF an hour ago
dr_dshiv 11 hours ago
davidbarker 11 hours ago
ChoosesBarbecue 10 hours ago
Tried out the first 1000 words in Pangram, and it seemed happy it was human written. Not surprised either, it has been some of the better writing I've seen out of Cloudflare recently.
terabyteoff 10 hours ago
mitxela 10 hours ago
Fordec 9 hours ago
killingtime74 8 hours ago
Fordec 8 hours ago
adrianN 6 hours ago
Fordec 3 hours ago
I also expect as AI becomes more cost sensitive once the quality plateaus (there's only so many ways to get an answer to 100% right), the data centers are going to chase where the cheap power is, and this long term is likely to be in high-solar locations. So lower latitudes. Doesn't rule out places like Texas of course, but places like India, Mexico, Brazil, Israel or Saudi Arabia will have home field advantages.
ricardobeat 12 hours ago
simonjgreen 12 hours ago
BobbyTables2 12 hours ago
One wants to turn on an indicator on a remote device. A simple Boolean value. But we need networking, TLS, authentication plugins, certificate validation, distributed logging, containers, orchestration, HTTP client/server, interprocess communication, daemon dependency management, …
Sure, one can say each of these layers and abstractions has an important and justifiable purpose. But one can also step back and start wondering - what the hell are we really doing???
At some level, it seems like each layer of abstraction has to manage others, only simply because they exist.
Imagine the simplicity of 1800s telegraph signaling - no software!
Too often we build systems with Fortune-50 style hierarchies when a 5-person team could do the whole job.
pixl97 11 hours ago
An 1800s telegraph system doesnt work in the modem world, there is far too much communication and the system would just collapse into molten slag.
All those things you've listed are because we live in an adversarial world and I'd steal all your money off the telegraph wire if you tried it.
HPsquared 43 minutes ago
sroussey 11 hours ago
jeffrallen 11 hours ago
But Oracle probably deleted then so you'll have to find them on archive.org.
datadrivenangel 7 hours ago
nikanj 11 hours ago
mitxela 10 hours ago
GroksBarnacles 7 hours ago
Are you trying to succinctly say AL'S spaghetti code outweighs the benefits of what it produces quickly?
If you're not saying it outweighs it, what are you saying?
adrianN 6 hours ago
anigbrowl 6 hours ago
sb057 5 hours ago
Around the year 2015.
procaryote 2 hours ago
The team that owns it needs to understand it. Everyone else can just use it.
proc0 12 hours ago
agosta 12 hours ago
agosta 12 hours ago
terabyteoff 12 hours ago
schobi 2 hours ago
parallax_error 11 hours ago
sroussey 11 hours ago
why_only_15 11 hours ago
sroussey 10 hours ago
halJordan 10 hours ago
variety8675 8 hours ago
jiggawatts 6 hours ago
It is purpose-designed for exactly this type of proxy/cache load-balancing scenario!
sfink 4 hours ago
I read the article thinking it would make for a great brain puzzle, but I quickly decided there's something wrong with the question setup because the initial solution didn't make sense. I assumed it was just missing a constraint that would be revealed later, but I'm still not seeing it -- the article just kept patching up the flaws in the wrong solution, the one that is more complicated than the straightforward one.
I'm probably still missing something obvious? It's probably something to do with "...in a way that does not require large changes when servers are added or removed."
But let's start with the problem as initially posed: you have an infinite stream of tasks and you need to deterministically assign them to N servers. (Perhaps you have to shard the collections of servers, so not every load balancer knows about all of them? But no, that would break the solution in the article.) Ok, then hash the task request (I assume that you hash it, the article doesn't explicitly say, but that's how you'd get determinism) and take that hash mod N, that's your server index.
Why hash the servers too? If you roll 6 dice, and then another one to choose which die to use, you're not getting any more randomness. You're matching up two sides, the tasks on one side and the servers on the other; no need to randomize both.
Ooh, but that's not a perfect distribution? Ok, if the hash value is large enough to be in the at most N-1 slop values at the top of UINT_MAX, then roll again (compute another hash). But CF is happy with 8% unevenness, there should be no problem with this 0.1% or whatever.
Also, how do they find the nearest server hash to a task hash? Surely it's not a log(n) binary search through sorted server hashes, I hope?
Weights break this scheme. Now each server has some number of tickets. So you compute hash % T (where T=total tickets) and have to figure out what server that is. There's probably a more clever way, but you could make a big array of (2-byte!) server indexes, one per ticket, and just fill them in and look up at index hash % T.
That's 2 bytes per ticket, which feels uncomfortably wasteful if weights can be large. That's where things get more complicated for me: since the tasks are hashed, it doesn't matter what order a server's indexes come in relative to other servers', so sort them by descending weight. [I'm starting to suspect I'm making a fool of myself here by missing something obvious with the whole setup...] Now you can make an array of indexes for servers with the highest weight, then the next lower, then the next. Record the number of servers of each weight. Then you can take the hash % T and figure out which array it's in, then divide by the weight to give the index within that array.
To reduce the number of per-weight arrays, you can restrict the weights allowed. If you restrict weights to be powers of two, you can eliminate a division by using a shift. If you really want more flexible weights, you can allow servers to be in more than one of the arrays. Let the arrays be powers of two, and then add an entry to each array corresponding to 1 bits in the binary representation of the weights. That increases the total memory usage of the arrays, so you could somewhat restrict the allowed weights by rounding to the nearest number with, say, 2 or 3 "on" bits at most. With at most 2 bits, that means weights are 1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 16, 17, .... The error really isn't bad.
And this should all be easily doable without any branches, I'm pretty sure. As long as you statically cap the max weight.
Anyway, that's just plowing through with the straightforward approach, and I still think I'm probably missing something major here. I imagine with large numbers of servers, some go down, so fast deletions are probably important. You can get by a little while by marking dead servers and if you "roll" one, just roll again. (Yes, deterministically, assuming other load balancers agree that the server is down.) But when more than some number of servers go down, you'd want to kick off a background task to rebuild a new set of tables -- so that's a factor 2 in size usage to have them both in memory during the rebuild.
Adding is trickier, you'd probably want to do a 2-level structure where first you use the hash to decide whether it's in the old set that the table is built for or the set of servers that hasn't been incorporated yet (you'd collect these over time, and empty them out on the next table rebuild.) It's a little weird, because the load balancers' outputs would only agree when the added and deleted sets agreed, but I don't see how to do better than that. (I think you could set up some kind of synchronization scheme so that the old sets would agree, which would make them usually agree on which of the old set of machines gets it.)
Somebody, feel free to tell me I'm being stupid! I'm sure there's a constraint that I'm missing, given that my understanding of the initial problem doesn't require any memory at all except for the servers' info.
(Or if not, I'll let you know where I'd like to receive shipment of 1% of the memory I've saved...)
procaryote 2 hours ago
This is useful because you want stickiness, so requests for the same key mostly go to the same server.
Sorting servers by weight means that removing or adding a server will shift a lot of traffic from the servers it used to go to. A flapping server early in the list will break stickiness for the whole set of servers.
The simplicity of stable hashing means you don't have to think about new sets, old sets, table rebuilds, synchronisation schemes etc, and that's useful because every such extra step adds bugs and corner cases
kingleopold 11 hours ago
swe_dima 10 hours ago