Saving another 100TB of RAM

(blog.cloudflare.com)

126 points | by f311a 3 hours ago

9 comments

  • dr_dshiv 28 minutes ago
    Cloudflare is truly amazing, they have made so much possible for my main side-project at a price and performance that I can’t really take credit for (http://sourcelibrary.org), I don’t care if their text was written with AI, I just wish I could get my own AI to sing so well about hashing… but wait.. today I noticed Claude trying to use hashing when a timestamp would honestly do, and now I’m really doubting myself, hmm…
    • davidbarker 22 minutes ago
      This is pleasant coincidence. Really like your site and it's queued to send in my newsletter in the morning! Just happened to see your comment here while I was reading. Great work.
  • ricardobeat 1 hour ago
    These optimizations are impressive, but it gets me thinking: at what point does a company become a collection of impenetrable siloes, where nothing really does what you expect? Maybe know with AI this is less of an issue as exploring a codebase is also much faster.
    • BobbyTables2 36 minutes ago
      I feel like any company whose products have RESTful interfaces are already there…

      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 8 minutes ago
        Build a system as simple as possible but no simpler.

        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.

    • simonjgreen 39 minutes ago
      My intuition around larger companies is they are already impenetrable silos, and AI makes it worse
  • proc0 1 hour ago
    The only Rust section is the one on storage improvements about the struct that stores the hash, but do they really need that many hashes that 2 bytes makes that big of a difference? Article doesn't expand, but I guess it's a hash for every task on every computer, so maybe yes.
    • agosta 1 hour ago
      That's exactly his point/the area of cost saving - that they didn't actually need as many hashes as they had started with. The trick was in finding out how many hashes they could cull without degrading load balance.
  • agosta 1 hour ago
    Bang up article! As someone who doesn't get to do enough (almost any) calculus in my daily programming assignments, I thoroughly enjoyed reading about Kevin's dive into that derivation (linked in the supplemental article). All the people being negative here can swallow raisins
    • terabyteoff 52 minutes ago
      Thanks! Maybe dial it back or people are going to think I paid you
  • kingleopold 11 minutes ago
    anyone remember 100tb hosting company?
  • jamesforestwest 32 minutes ago
    [dead]
  • johnnyApplePRNG 2 hours ago
    [flagged]
  • officialchicken 1 hour ago
    [flagged]
    • globnomulous 37 minutes ago
      If you have a real, actual, substantive critique of either the post or package itself, I'd be interested in reading that. What you posted doesn't provide that. I'm not sure who you're talking to or what you expect your comment to accomplish.
    • terabyteoff 31 minutes ago
      You got me! I keep meaning to do this.

      https://github.com/cloudflare/pingora/issues/1014

      I have now solved the problem once and for all

    • cyberpunk 1 hour ago
      Anyone have an idea how it behaves differently from google's jump hash algorithm? The cool thing about google's one is it's so short I can include it in a HN comment:

          int32_t JumpConsistentHash(uint64_t key, int32_t num_buckets) {
            int64_t b = 1, j = 0;
            while (j < num_buckets) {
              b = j;
              key = key * 2862933555777941757ULL + 1;
              j = (b + 1) * (double(1LL << 31) / double((key >> 33) + 1));
            }
            return b;
          }
      
      https://arxiv.org/pdf/1406.2294
      • prirun 9 minutes ago
        I have used Google's jump hash. As I recall, one of the main differences is that jump hash doesn't have a mechanism to remove targets, eg, a server dies and you don't want to route requests to it. Traditional consistent hashing can do that. I guess if you had 4 servers, server #4 dies, then you can go back to 3 servers by just changing num_buckets from 4 to 3. But if server 1 dies, you can't.

        Jump hash does allow adding more targets and preserves the property that most request targets stay the same when adding a new target, so if you had 3 targets and add a fourth, ~8% of the requests that would have been sent to targets 1-3 are sent to target 4, evenly chosen from servers 1-3.

      • cyberpunk 1 hour ago
        Well I looked it up; nginx, apparently, uses ketama -- it's a ring-style hash probably works better for web backends than the jch above, as when given [0,1,2,3] and replacing the server in slot 1 you're going to have a lot of hash moves. With ketama, you'd only have the '1' hashes moving. You can't really beat google's for brevity, though.
    • agosta 1 hour ago
      We can tell you didn't read the post because it is definitively NOT garbage. Very interesting write up by the Cloudflare team - the man literally did calculus to improve something. When's the last time any of us did Calculus to improve anything? Bang up job Kevin and everyone!!
  • go_elmo 2 hours ago
    [flagged]
    • n738 1 hour ago
      go_elmo is unimpressed everyone. Pack it up. Time to go home.
    • Maxion 2 hours ago
      I think it's more important now than it was last year to differentiate pure yolo vibecoding from "AI assisted engineering" or "AI engineering", I.e. deliberate and careful use of AI to speed up coding but without creating too much slop. Maybe aineering?
      • wild_pointer 2 hours ago
        Nah, AI code is black or white, and whether the code is good depends on your religion.
      • kawogi 2 hours ago
        AIded development?
        • derwiki 2 hours ago
          Just like the original harness, aider.chat
    • readthenotes1 1 hour ago
      I expect a another post in a year where they get a performance improvement by reducing the number of calls to create integers from bytes.