Table of Contents
A membase client library implemention should be very similar to a memcached (binary protocol) client library implementation (and might even be an extension of some existing memcached binary-protocol client library), but just supports a different key hashing approach. Instead of using modulus or ketama/consistent hashing, the new hashing approach in membase is instead based around "vbuckets", which you can read up more about here
In the vbucket approach, to find a server to talk to for a given key, your client library should hash the key string into a vbucket-Id (a 16-bit integer). The default hash algorithm for this step is plain old CRC, masked by the required number of bits. The vbucket-Id is then used as an array index into a server lookup table, which is also called a vbucket-to-server map. Those two steps will allow your client library to find the right membase server given a key and a vbucket-to-server map. This extra level of indirection (where we have an explicit vbucket-to-server map) allows membase to easily control item data rebalancing, migration and replication.