Book Image

Cassandra High Availability

By : Robbie Strickland
Book Image

Cassandra High Availability

By: Robbie Strickland

Overview of this book

Table of Contents (16 chapters)
Cassandra High Availability
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Consistent hashing


To solve the problem of locating a key in a distributed hash table, we use a technique called consistent hashing. Introduced as a term in 1997, consistent hashing was originally used as a means of routing requests among large numbers of web servers. It's easy to see how the Web can benefit from a hash mechanism that allows any node in the network to efficiently determine the location of an object, in spite of the constant shifting of nodes in and out of the network. This is the fundamental objective of consistent hashing.

The mechanics of consistent hashing

With consistent hashing, the buckets are arranged in a ring with a predefined range; the exact range depends on the partitioner being used. Keys are then hashed to produce a value that lies somewhere along the ring. Nodes are assigned a range, which is computed as follows:

Range start

Range end

Token value

Next token value - 1

Note

The following examples assume that the default Murmur3Partitioner is used. For more information...