logoalt Hacker News

officialchickentoday at 8:33 PM4 repliesview on HN

Come on CF, you can't even be bothered vibe a README for the crate? Somebody tear down this post until this garbage is documented properly.

I found this in the code, it looks like a rewrite-in-rust:

//! # pingora-ketama

//! A Rust port of the nginx consistent hashing algorithm.

//!

//! This crate provides a consistent hashing algorithm which is identical in

//! behavior to [nginx consistent hashing](https://www.nginx.com/resources/wiki/modules/consistent_hash...).

//!

//! Using a consistent hash strategy like this is useful when one wants to

//! minimize the amount of requests that need to be rehashed to different nodes

//! when a node is added or removed.


Replies

terabyteofftoday at 9:34 PM

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

globnomuloustoday at 9:28 PM

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.

cyberpunktoday at 8:49 PM

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
show 2 replies
agostatoday at 8:44 PM

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!!