Highest Random Weight in Elixir

(jola.dev)

47 points | by shintoist 2 days ago ago

2 comments

  • yuliyp 3 hours ago ago

    The hierarchical (log(n)) approach to bucketing here is fine for an "I just want to shard this N ways, N will never change" but is extremely intolerant of bucket mutations.

    Part of the point of rendezvous hash and consistent hashing is that adding and removing elements minimizes the amount of things reassigned. That is, if you add nodes, the only items being reassigned are those that are moving to the new nodes. If you remove nodes, the only items being reassigned are those leaving the departing nodes.

    If you know your set of nodes never changes, or you don't care about the cost of reassignment, you don't need a rendezvous hash or consistent hash, you just need a plain old hash function.

  • drmanhat 23 minutes ago ago

    Unless you are operating at FAANG scale or are in HFT I really struggle to see how O(n) would ever be a problem for you here.