/plushcap/analysis/couchbase/couchbase-scaling-memcached-vbuckets

Scaling memcached with vbuckets

What's this blog post about?

Memcached is a distributed caching system that uses simple modulo selection hash algorithm for distributing data across servers. However, this method can lead to some problems such as uneven distribution of cache load and increased cache misses when a server dies. In 2007, Richard Jones introduced Ketama, a consistent hashing library that reduces the probability of hashing to a server without the required data when the server list changes. An alternative approach called "managed buckets" was introduced by Anatoly Vorobey in early 2006. This method uses vbuckets (a subset of all possible keys) that are statically mapped to servers, providing more flexibility and control over data distribution. The number of vbuckets remains constant regardless of server topology, ensuring consistent key-to-vbucket mapping. In this approach, each request includes the vbucket id as computed by the hashing algorithm. Clients agree on the hashing algorithm and number of vbuckets to ensure consistency in choosing the right vbucket. The libvbucket library helps distribute configurations and react to misconfigurations. Vbuckets can be transferred from one server to another, allowing for gradual migration of traffic from busy servers to less busy ones with minimal impact. A replica vbucket is similar to a dead vbucket in that it refuses all requests but allows replication commands. Multiple replication strategies such as 1:n and chained replication can be used to maintain multiple copies of data across nodes.

Company
Couchbase

Date published
Dec. 16, 2014

Author(s)
Dustin Sallings, Chief Architect, Couchbase

Word count
1999

Language
English

Hacker News points
None found.


By Matt Makai. 2021-2024.