Description

Investigation of observed different caching between spymemcached and moxi in one environment shows that moxi is inadvertantly using the default from libmemcached. I say inadvertantly because that default may actually be the less common choice. It is different than what Enyim, Spymemcached and libketama do by default when selecting Ketama.

libmemcached seems to use non-weighted Ketama, which seems to be specific to libmemcached and does not define the hash continuum the same way. Specifically, it seems to define the continuum with 100 points per server, rather than the 160 commonly used.

This will be a change of compatibility when integrated. The way moxi hashes to memcached buckets will change. As pointed out previously, this is probably somewhat okay (given that it's a cache) during an upgrade, but the time to make the change is during a dot-minor version change, not a dot-micro patch update.

Matt Ingenthron
added a comment - 24/May/11 6:41 PM I would argue against deferring this to 1.7.1. Why?
This will be a change of compatibility when integrated. The way moxi hashes to memcached buckets will change. As pointed out previously, this is probably somewhat okay (given that it's a cache) during an upgrade, but the time to make the change is during a dot-minor version change, not a dot-micro patch update.

Enables or disables compatibility with libketama-like behavior. When enabled, the item key hashing algorithm is set to MD5 and distribution is set to be weighted consistent hashing distribution. This is useful because other libketama-based clients (Python, Ruby, etc.) with the same server configuration will be able to access the keys transparently.

Note:

It is highly recommended to enable this option if you want to use consistent hashing, and it may be enabled by default in future releases.

Steve Yen
added a comment - 10/May/11 8:14 PM The right choice seems to be to turn on ketama-weighted by default...
ruby - fauna memcached (libmemcached wrapper) uses ketama-weighted
:ketama_weighted => true,
For PHP, the default distribution is MODULA distribution. However, from documentation in http://www.php.net/manual/en/memcached.constants.php, the safety tips around ketama hashing...
Memcached::OPT_LIBKETAMA_COMPATIBLE
Enables or disables compatibility with libketama-like behavior. When enabled, the item key hashing algorithm is set to MD5 and distribution is set to be weighted consistent hashing distribution. This is useful because other libketama-based clients (Python, Ruby, etc.) with the same server configuration will be able to access the keys transparently.
Note:
It is highly recommended to enable this option if you want to use consistent hashing, and it may be enabled by default in future releases.

Matt Ingenthron
added a comment - 10/May/11 8:11 PM Fix is in MB-3798 and it's associated commit, but this bug should remain open since it really describes a different issue. Namely, this bug describes whether or not it should be turned on.

Matt Ingenthron
added a comment - 10/May/11 8:02 PM I know it seems odd to file this as a low priority issue, and while it affects consistency when caching, it's believed that the number of times moxi is combined with Spy|Enyim is probably rare.
Also, a fix is available, but disabled by default.