I learned recently that Cachex supports distributed caching, and when checking the implementation I saw that it uses consistent hashing. I wonder if there is any interest in implementing the approach described in https://en.wikipedia.org/wiki/Rendezvous_hashing?
I did some experiments with it some years ago and thought at the time that it's a bit more straightforward than https://github.com/discord/ex_hash_ring as the basic implementation doesn't require any 3rd party NIFs or keeping extra in-memory state.
defmodule Cachex.Router.Rendezvous do
def route(key) do
{node, _} =
[Node.self() | Node.list()]
|> Enum.map(fn node -> {node, :erlang.phash2({key, node})} end)
|> Enum.max_by(fn {_node, hash} -> hash end)
node
end
end
👋
I learned recently that Cachex supports distributed caching, and when checking the implementation I saw that it uses consistent hashing. I wonder if there is any interest in implementing the approach described in https://en.wikipedia.org/wiki/Rendezvous_hashing?
I did some experiments with it some years ago and thought at the time that it's a bit more straightforward than https://github.com/discord/ex_hash_ring as the basic implementation doesn't require any 3rd party NIFs or keeping extra in-memory state.