Search:

Search all manuals
Search this manual
Manual
Membase Manual 1.7
Additional Resources
Community Wiki
Community Forums
Couchbase SDKs
Parent Section
Membase Manual 1.7
Child Sections
Chapters

Chapter 7. Developing Membase Clients

Table of Contents

7.1. REST/JSON
7.1.1. Parsing the JSON
7.1.2. Encoding the vbucketId into each request
7.1.3. Client Libraries and Rebalancing
7.1.4. Fast Forward Map
7.1.5. Redundancy & Availability
7.2. libvbucket libjvbucket SASL Authentication Example
7.2. List Mechanisms
7.2. Authentication request

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.