Home > 16ms > Intelligent Route Balancing & Consistent Hashing Algorithm…

Intelligent Route Balancing & Consistent Hashing Algorithm…

October 10th, 2008 AVC Leave a comment Go to comments

I have run into consistent hashing a couple of times. So what is consistent hashing and why should you care?

The need for consistent hashing arose from limitations experienced while running collections of caching machines. The common way, if you have a collection of n cache machines, is to put the object o in cache machine number hash(o) mod n.This shude works until you remove or add a cache machine. The reason then n changes and every object is hashed to a new location

The conclusion of that is , it would be usefull if a cache machine was added, it took its fair share of objects from all the other cache machines or when a cache machine was removed the objects were shared between the remaining machines.

Thats was what consistent hashing does – consistently maps objects to the same cache machine, as far as is possible, at least.

Architecture with consistent hashing and route balancing in a Grid (yes it a data-grid):

affinity_white.png

This  diagram illustrates the difference between using route balancing in data grid or without route balancing . The left side shows execution flow without route balancing. In this case the data is then delivered to caller (master) node that call the back nodes ,wich can be a Cache Node. This case can be faster than DB access, but results into unnecessary network traffic.

The right side you can see the routing and balancing. The whole computation logic together with data access logic is brought to data server for local execution. Assuming that serialization of computation logic is much lighter than serializing data, the network traffic in this case is minimal. Also, your computation may access data from both, Node 2 and Node 3.This case is without unnecessary network traffic and quit fast than DB access.

That’s is the idea behind the Intelligent Route Balancing  Consistent Hashing Algorithm :)

-avc (Arkadiusz Victor Czarnik)

Categories: 16ms Tags:
  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.