View all Courses. All rights reserved. Courses Pricing. What is a distributed hash table? Just like in hash tables, values mapped against keys in a DHT can be any arbitrary form of data.
Fault Tolerant: System is reliable with lots of nodes joining, leaving, and failing at all times. Scalable: System should function efficiently with even thousands or millions of nodes. Just like hash tables, DHTs support the following 2 functions: put key, value get key The nodes in a DHT are connected together through an overlay network in which neighboring nodes are connected.
Keep Exploring. Each node has a reference pointer to the node previous as well as next to it. The node next to the node in question is called the successor.
The node that is previous to the node in question is called the predecessor. Speaking in terms of a DHT, each node has a unique node ID of k bits and these nodes are arranged in the increasing order of their node IDs. Assume these nodes are arranged in a ring structure called identifier ring.
For each node, the successor has the shortest distance clockwise away. To find out the node appropriate for a particular key, first hash the key K and all the nodes to exactly k bits using consistent hashing techniques like SHA Start at any point in the ring and traverse clockwise till you catch the node whose node ID is closer to the key K, but can be greater than K.
This node is the one responsible for storage and lookup for that particular key. In an iterative style of lookup, each node Q queries its successor node for KV key-value pair. If the queried node does not have the target key, it will return a set of nodes S that can be closer to the target. The querying node Q then queries the nodes in S which are closer to itself.
This continues until either the target KV pair is returned or when there are no more nodes to query. This lookup is very suitable for an ideal scenario where all the nodes have a perfect uptime. But how to handle scenarios when nodes leave the network either intentionally or by failure?
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?
Collectives on Stack Overflow. Learn more. Asked 13 years, 1 month ago. Active 7 months ago. Viewed 75k times. Could any one give an explanation on how a DHT works? Nothing too heavy, just the basics. Improve this question. Gustavo Carreno Gustavo Carreno 8, 13 13 gold badges 43 43 silver badges 74 74 bronze badges. Add a comment. Active Oldest Votes. Improve this answer. HenryR HenryR 7, 6 6 gold badges 32 32 silver badges 38 38 bronze badges.
What you mean in third paragraph "One example DHT that tackles some of these problems is a logical ring of n nodes" is Consistent Hashing. It's a really interesting topic, used in Apache Cassandra, a Distributed database created by Facebook.
Link to paper worth reading it : cs. A ring-based lookup protocol that is pretty easy to understand is Chord: pdos. Each node in the system stores a part of the hash table. The nodes are interconnected in a structured overlay network , which enables efficient delivery of the key lookup and key insertion requests from the requestor to the node storing the key.
To guarantee robustness to arrivals and departures of nodes, the overlay network topology is maintained and the key-value pairs are replicated to several nodes.
Every DHT defines its key space. Each node in the system has a specific location in the key space and stores the key-value pairs that are close to that location. The different DHT systems vary in the exact algorithms for deciding which node should store which key [ 2 ].
Skip to main content Skip to table of contents.
0コメント