Skip to Main Content
Hands-On Software Architecture with Golang
book

Hands-On Software Architecture with Golang

by Jyotiswarup Raiturkar
December 2018
Intermediate to advanced content levelIntermediate to advanced
500 pages
12h 19m
English
Packt Publishing
Content preview from Hands-On Software Architecture with Golang

Data distribution

One simple way of partitioning rows over a set of nodes is to use hashing. You can pick a hash function, and use something such as hash(key_x) % n_nodes to get the node that would store the data for key_x. The problem with this scheme is that adding/deleting nodes would mean that the hash(key_x) % n_nodes values would change for pretty much all the keys, and thus cluster scaling would mean moving around a lot of data.

To get around this, Cassandra uses a concept called consistent hashing. We had looked at consistent hashing in Chapter 5, Going Distributed. Here is a quick recap:

Consider a circle with values on it ranging from [0-1], that is, any point on the circle has a value between 0 and 1. Next, we pick a favorite hashing ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Event-Driven Architecture in Golang

Event-Driven Architecture in Golang

Michael Stack

Publisher Resources

ISBN: 9781788622592Supplemental Content