Ring is senstive to server names #318

jaroslawr opened this Issue Jan 16, 2013 · 1 comment


None yet
2 participants

I have two servers, alpha and beta, each running a memcached server on port 11211 and a Ruby installation. I now create a Dalli client on both of those servers, on alpha I do:

c = Dalli::Client.new('localhost:11211', 'beta:11211')

And on beta:

c = Dalli::Client.new('localhost:11211', 'alpha:11211')

Which is the same thing really, but unfortunately won't work correctly because Dalli::Ring depends on the server name for distributing the keys between the nodes, from Dali::Ring#initialize:

servers.each do |server|
  entry_count_for(server, servers.size, total_weight).times do |idx|
    hash = Digest::SHA1.hexdigest("#{server.hostname}:#{server.port}:#{idx}")
    value = Integer("0x#{hash[0..7]}")
    continuum << Dalli::Ring::Entry.new(value, server)

This leads to difficult to track bugs, so maybe it could be fixed or at the very least better documented.


mperham commented May 27, 2013

This is by design, all servers should use the exact same server names and ordering.

mperham closed this May 27, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment