Distributed Routing - aemadrid/orientdb GitHub Wiki
Distributed routing of requests
Introduction
When OrientDB is running in Distributed-Architecture, uses a routing mechanism to:
- balance the load
- assure there are no conflicts in the creation of new records
!WORK IN PROGRESS!
Distributed Hash Table
The OrientDB Distributed-Architecture uses a Distributed Hash Table (DHT) to dynamically create partition with ranges of keys.
What is a DHT?
Wikipedia explain quite well this concept.
"A distributed hash table (DHT) is a class of a decentralized distributed system that provides a lookup service similar to a hash table; (key, value) pairs are stored in a DHT, and any participating node can efficiently retrieve the value associated with a given key. Responsibility for maintaining the mapping from keys to values is distributed among the nodes, in such a way that a change in the set of participants causes a minimal amount of disruption. This allows a DHT to scale to extremely large numbers of nodes and to handle continual node arrivals, departures, and failures."
How does it work ?
Requests are always routed to the owner Server Node. Imagine this as a ring (DHT) where each Server Node is the owner of a part of the database. When a client updates a record, the request is always forwarded to the owner node.
http://www.orientdb.org/images/routing.png
In this example Client #1 is connected to the Server Node #3 and it is updating a customer with ID 3,766. Now this portion of database is owned by Server Node #1, so the Server Node #3 transparently routes the request to the Server Node #1.
Server Node #1 executes the update and send back the response to the Server Node #3. Server Node #3 sends the response back to the client.
In this way doesn't matter where is connected the client and the client isn't aware about internal partitioning of the database, even because changes every time the cluster configuration changes.
http://www.orientdb.org/images/routing-example.png
Isn't this slow ?
Routing is usually associated with Replication. In this case the overhead is zero because the operation would be replicated against the Server Node #3 as well, so with routing the flow is changed but no overhead is generated.
Further readings
Continue with: