Inconsistent key hashing

87 views
Skip to first unread message

Sam

unread,
Jun 20, 2013, 4:21:50 PM6/20/13
to spymem...@googlegroups.com
Hi,

I am using multiple spy memcached clients which are configured to use 4 memcached servers.
All clients are configured exactly the same way using consistent hashing with redistribute fail-over mode.

The issue I have is that sometimes the same key is written to different servers. I would have expected the same key to be always written to the same memcached server ?
The servers are always available but I'm not 100% sure if some networking issues might be causing inconsistency when writing the key to different servers.

Thanks Sam.

Matt Ingenthron

unread,
Jun 20, 2013, 5:04:24 PM6/20/13
to spymem...@googlegroups.com
There was a bug fixed in the 2.6 days that could cause slightly different ketama hashing and it was release noted. Other than that, I don't think you should hit this issue. What versions are you talking about?

Is it possible the hostnames could resolve differently (even reverse lookup) between the two different versions of clients?

If you can identify a key, the versions, and how you're constructing the MemcachedClient object, it should be fairly quick to see if this can be reproduced in a unit test.

Thanks,



Sam

unread,
Jun 24, 2013, 5:11:59 AM6/24/13
to spymem...@googlegroups.com
Hi,

My client is configured as follows:

        ConnectionFactoryBuilder cfb = new ConnectionFactoryBuilder();
        cfb.setFailureMode(FailureMode.Redistribute);
        cfb.setOpTimeout(1000);
        cfb.setProtocol(Protocol.TEXT);
        cfb.setHashAlg(KETAMA_HASH)
        cfb.setLocatorType(Locator.CONSISTENT);

The spy memcached version in use is : 2.8.4

Sample key: user.sessions.useragent12345xyz.1234xyz12.1

I have 2 memcached servers configured as follows AddrUtil().getAddresses("hostname:port,hostname,port")

The issue can be recreated very quickly where the key above is seen in both memcached servers.

Regards,
Sam

Sam

unread,
Jun 24, 2013, 5:13:12 AM6/24/13
to spymem...@googlegroups.com
sorry small type in previous post : AddrUtil().getAddresses("hostname:port,hostname:port")
Reply all
Reply to author
Forward
0 new messages