Distributed hash table
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. Keys are unique identifiers which map to particular values, which in turn can be anything from addresses, to documents, to arbitrary data.[1] 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.
DHTs form an infrastructure that can be used to build more complex services, such as anycast, cooperative Web caching, distributed file systems, domain name services, instant messaging, multicast, and also peer-to-peer file sharing and content distribution systems. Notable distributed networks that use DHTs include BitTorrent's distributed tracker, the Coral Content Distribution Network, the Kad network, the Storm botnet, the Tox instant messenger, Freenet, the YaCy search engine, and the InterPlanetary File System.
Contents
1 History
2 Properties
3 Structure
3.1 Keyspace partitioning
3.1.1 Consistent hashing
3.1.2 Rendezvous hashing
3.1.3 Locality-preserving hashing
3.2 Overlay network
3.3 Algorithms for overlay networks
4 Security
5 DHT implementations
6 Examples
7 See also
8 References
9 External links
History
DHT research was originally motivated, in part, by peer-to-peer systems such as Freenet, gnutella, BitTorrent and Napster, which took advantage of resources distributed across the Internet to provide a single useful application. In particular, they took advantage of increased bandwidth and hard disk capacity to provide a file-sharing service.[2]
These systems differed in how they located the data offered by their peers. Napster, the first large-scale P2P content delivery system, required a central index server: each node, upon joining, would send a list of locally held files to the server, which would perform searches and refer the queries to the nodes that held the results. This central component left the system vulnerable to attacks and lawsuits.
Gnutella and similar networks moved to a flooding query model – in essence, each search would result in a message being broadcast to every other machine in the network. While avoiding a single point of failure, this method was significantly less efficient than Napster. Later versions of Gnutella clients moved to a dynamic querying model which vastly improved efficiency.[3]
Freenet is fully distributed, but employs a heuristic key-based routing in which each file is associated with a key, and files with similar keys tend to cluster on a similar set of nodes. Queries are likely to be routed through the network to such a cluster without needing to visit many peers.[4] However, Freenet does not guarantee that data will be found.
Distributed hash tables use a more structured key-based routing in order to attain both the decentralization of Freenet and gnutella, and the efficiency and guaranteed results of Napster. One drawback is that, like Freenet, DHTs only directly support exact-match search, rather than keyword search, although Freenet's routing algorithm can be generalized to any key type where a closeness operation can be defined.[5]
In 2001, four systems—CAN,[6]Chord,[7]Pastry, and Tapestry—ignited DHTs as a popular research topic.
A project called the Infrastructure for Resilient Internet Systems (Iris) was funded by a $12 million grant from the US National Science Foundation in 2002.[8]
Researchers included Sylvia Ratnasamy, Ion Stoica, Hari Balakrishnan and Scott Shenker.[9]
Outside academia, DHT technology has been adopted as a component of BitTorrent and in the Coral Content Distribution Network.
Properties
DHTs characteristically emphasize the following properties:
Autonomy and decentralization: the nodes collectively form the system without any central coordination.
Fault tolerance: the system should be reliable (in some sense) even with nodes continuously joining, leaving, and failing.
Scalability: the system should function efficiently even with thousands or millions of nodes.
A key technique used to achieve these goals is that any one node needs to coordinate with only a few other nodes in the system – most commonly, O(log n) of the n{displaystyle n} participants (see below) – so that only a limited amount of work needs to be done for each change in membership.
Some DHT designs seek to be secure against malicious participants[10] and to allow participants to remain anonymous, though this is less common than in many other peer-to-peer (especially file sharing) systems; see anonymous P2P.
Finally, DHTs must deal with more traditional distributed systems issues such as load balancing, data integrity, and performance (in particular, ensuring that operations such as routing and data storage or retrieval complete quickly). This is achieved via simplistic vector sequencing models that rely on dynamic interface value encryption over a static server-client manifold.[11]
Structure
The structure of a DHT can be decomposed into several main components.[12][13] The foundation is an abstract keyspace, such as the set of 160-bit strings. A keyspace partitioning scheme splits ownership of this keyspace among the participating nodes. An overlay network then connects the nodes, allowing them to find the owner of any given key in the keyspace.
Once these components are in place, a typical use of the DHT for storage and retrieval might proceed as follows. Suppose the keyspace is the set of 160-bit strings. To index a file with given filename and data in the DHT, the SHA-1 hash of filename is generated, producing a 160-bit key k, and a message put(k, data) is sent to any node participating in the DHT. The message is forwarded from node to node through the overlay network until it reaches the single node responsible for key k as specified by the keyspace partitioning. That node then stores the key and the data. Any other client can then retrieve the contents of the file by again hashing filename to produce k and asking any DHT node to find the data associated with k with a message get(k). The message will again be routed through the overlay to the node responsible for k, which will reply with the stored data.
The keyspace partitioning and overlay network components are described below with the goal of capturing the principal ideas common to most DHTs; many designs differ in the details.
Keyspace partitioning
Most DHTs use some variant of consistent hashing or rendezvous hashing to map keys to nodes. The two algorithms appear to have been devised independently and simultaneously to solve the distributed hash table problem.
Both consistent hashing and rendezvous hashing have the essential property that removal or addition of one node changes only the set of keys owned by the nodes with adjacent IDs, and leaves all other nodes unaffected. Contrast this with a traditional hash table in which addition or removal of one bucket causes nearly the entire keyspace to be remapped. Since any change in ownership typically corresponds to bandwidth-intensive movement of objects stored in the DHT from one node to another, minimizing such reorganization is required to efficiently support high rates of churn (node arrival and failure).
Consistent hashing
Consistent hashing employs a function δ(k1,k2){displaystyle delta (k_{1},k_{2})} that defines an abstract notion of the distance between the keys k1{displaystyle k_{1}} and k2{displaystyle k_{2}}, which is unrelated to geographical distance or network latency. Each node is assigned a single key called its identifier (ID). A node with ID ix{displaystyle i_{x}} owns all the keys km{displaystyle k_{m}} for which ix{displaystyle i_{x}} is the closest ID, measured according to δ(km,ix){displaystyle delta (k_{m},i_{x})}.
For example, the Chord DHT uses consistent hashing, which treats keys as points on a circle, and δ(k1,k2){displaystyle delta (k_{1},k_{2})} is the distance traveling clockwise around the circle from k1{displaystyle k_{1}} to k2{displaystyle k_{2}}. Thus, the circular keyspace is split into contiguous segments whose endpoints are the node identifiers. If i1{displaystyle i_{1}} and i2{displaystyle i_{2}} are two adjacent IDs, with a shorter clockwise distance from i1{displaystyle i_{1}} to i2{displaystyle i_{2}}, then the node with ID i2{displaystyle i_{2}} owns all the keys that fall between i1{displaystyle i_{1}} and i2{displaystyle i_{2}}.
Rendezvous hashing
In rendezvous hashing, also called highest random weight hashing, all clients use the same hash function h() (chosen ahead of time) to associate a key to one of the n available servers.
Each client has the same list of identifiers {S1, S2, ..., Sn }, one for each server.
Given some key k, a client computes n hash weights w1 = h(S1, k), w2 = h(S2, k), ..., wn = h(Sn, k).
The client associates that key with the server corresponding to the highest hash weight for that key.
A server with ID Sx{displaystyle S_{x}} owns all the keys km{displaystyle k_{m}} for which the hash weight h(Sx,km){displaystyle h(S_{x},k_{m})} is higher than the hash weight of any other node for that key.
Locality-preserving hashing
Locality-preserving hashing ensures that similar keys are assigned to similar objects. This can enable a more efficient execution of range queries.
Self-Chord [14] decouples object keys from peer IDs and sorts keys along the ring with a statistical approach based on the swarm intelligence paradigm. Sorting ensures that similar keys are stored by neighbour nodes and that discovery procedures, including range queries, can be performed in logarithmic time.
Overlay network
Each node maintains a set of links to other nodes (its neighbors or routing table). Together, these links form the overlay network. A node picks its neighbors according to a certain structure, called the network's topology.
All DHT topologies share some variant of the most essential property: for any key k, each node either has a node ID that owns k or has a link to a node whose node ID is closer to k, in terms of the keyspace distance defined above. It is then easy to route a message to the owner of any key k using the following greedy algorithm (that is not necessarily globally optimal): at each step, forward the message to the neighbor whose ID is closest to k. When there is no such neighbor, then we must have arrived at the closest node, which is the owner of k as defined above. This style of routing is sometimes called key-based routing.
Beyond basic routing correctness, two important constraints on the topology are to guarantee that the maximum number of hops in any route (route length) is low, so that requests complete quickly; and that the maximum number of neighbors of any node (maximum node degree) is low, so that maintenance overhead is not excessive. Of course, having shorter routes requires higher maximum degree. Some common choices for maximum degree and route length are as follows, where n is the number of nodes in the DHT, using Big O notation:
Max. degree | Max route length | Used in | Note |
---|---|---|---|
O(1){displaystyle O(1)} | O(n){displaystyle O(n)} | Worst lookup lengths, with likely much slower lookups times | |
O(logn){displaystyle O(log n)} | O(logn){displaystyle O(log n)} | Chord Kademlia Pastry Tapestry | Most common, but not optimal (degree/route length). Chord is the most basic version, with Kademlia seeming the most popular optimized variant (should have improved average lookup) |
O(logn){displaystyle O(log n)} | O(logn/log(logn)){displaystyle O(log n/log(log n))} | Koorde | Likely would be more complex to implement, but lookups might be faster (have a lower worst case bound) |
O(n){displaystyle O({sqrt {n}})} | O(1){displaystyle O(1)} | Worst local storage needs, with lots of communication after any node connects or disconnects |
The most common choice, O(logn){displaystyle O(log n)} degree/route length, is not optimal in terms of degree/route length tradeoff, but such topologies typically allow more flexibility in choice of neighbors. Many DHTs use that flexibility to pick neighbors that are close in terms of latency in the physical underlying network.
Maximum route length is closely related to diameter: the maximum number of hops in any shortest path between nodes. Clearly, the network's worst case route length is at least as large as its diameter, so DHTs are limited by the degree/diameter tradeoff[15] that is fundamental in graph theory. Route length can be greater than diameter, since the greedy routing algorithm may not find shortest paths.[16]
Algorithms for overlay networks
Aside from routing, there exist many algorithms that exploit the structure of the overlay network for sending a message to all nodes, or a subset of nodes, in a DHT.[17] These algorithms are used by applications to do overlay multicast, range queries, or to collect statistics. Two systems that are based on this approach are Structella,[18] which implements flooding and random walks on a Pastry overlay, and DQ-DHT,[19] which implements a dynamic querying search algorithm over a Chord network.
Security
Because of the decentralization, fault tolerance, and scalability of DHTs, they are inherently more resilient against a hostile attacker than a typical centralized system.[vague]
Open systems for distributed data storage that are robust against massive hostile attackers are feasible.[20]
A DHT system that is carefully designed to have Byzantine fault tolerance can defend against a security weakness, known as the Sybil attack, which affects all current DHT designs.[21][22]
Petar Maymounkov, one of the original authors of Kademlia, has proposed a way to circumvent the weakness to the Sybil attack by incorporating social trust relationships into the system design.[23] The new system, codenamed Tonika or also known by its domain name as 5ttt, is based on an algorithm design known as Electric routing and co-authored with the mathematician Jonathan Kelner.[24] Maymounkov has now undertaken a comprehensive implementation effort of this new system, which is entirely based on the Go programming language. However, research into effective defences against Sybil attacks is generally considered an open question, and wide variety of potential defences are proposed every year in top security research conferences.
DHT implementations
Most notable differences encountered in practical instances of DHT implementations include at least the following:
- The address space is a parameter of DHT. Several real world DHTs use 128-bit or 160-bit key space
- Some real-world DHTs use hash functions other than SHA-1.
- In the real world the key k{displaystyle k} could be a hash of a file's content rather than a hash of a file's name to provide content-addressable storage, so that renaming of the file does not prevent users from finding it.
- Some DHTs may also publish objects of different types. For example, key k{displaystyle k} could be the node ID{displaystyle ID} and associated data could describe how to contact this node. This allows publication-of-presence information and often used in IM applications, etc. In the simplest case, ID{displaystyle ID} is just a random number that is directly used as key k{displaystyle k} (so in a 160-bit DHT ID{displaystyle ID} will be a 160-bit number, usually randomly chosen). In some DHTs, publishing of nodes' IDs is also used to optimize DHT operations.
- Redundancy can be added to improve reliability. The (k,data){displaystyle (k,data)} key pair can be stored in more than one node corresponding to the key. Usually, rather than selecting just one node, real world DHT algorithms select i{displaystyle i} suitable nodes, with i{displaystyle i} being an implementation-specific parameter of the DHT. In some DHT designs, nodes agree to handle a certain keyspace range, the size of which may be chosen dynamically, rather than hard-coded.
- Some advanced DHTs like Kademlia perform iterative lookups through the DHT first in order to select a set of suitable nodes and send put(k,data){displaystyle put(k,data)} messages only to those nodes, thus drastically reducing useless traffic, since published messages are only sent to nodes that seem suitable for storing the key k{displaystyle k}; and iterative lookups cover just a small set of nodes rather than the entire DHT, reducing useless forwarding. In such DHTs, forwarding of put(k,data){displaystyle put(k,data)} messages may only occur as part of a self-healing algorithm: if a target node receives a put(k,data){displaystyle put(k,data)} message, but believes that k{displaystyle k} is out of its handled range and a closer node (in terms of DHT keyspace) is known, the message is forwarded to that node. Otherwise, data are indexed locally. This leads to a somewhat self-balancing DHT behavior. Of course, such an algorithm requires nodes to publish their presence data in the DHT so the iterative lookups can be performed.
Examples
|
|
See also
Couchbase Server: a persistent, replicated, clustered distributed object storage system compatible with memcached protocol.
Memcached: a high-performance, distributed memory object caching system.
Prefix hash tree: sophisticated querying over DHTs.
Merkle tree: tree having every non-leaf node labelled with the hash of the labels of its children nodes.- Most distributed data stores employ some form of DHT for lookup.
Skip Graphs are an efficient data structure for implementing DHTs.
References
^ Stoica, I.; Morris, R.; Karger, D.; Kaashoek, M. F.; Balakrishnan, H. (2001). "Chord: A scalable peer-to-peer lookup service for internet applications" (PDF). ACM SIGCOMM Computer Communication Review. 31 (4): 149. doi:10.1145/964723.383071.A value can be an address, a document, or an arbitrary data item.
.mw-parser-output cite.citation{font-style:inherit}.mw-parser-output .citation q{quotes:"""""""'""'"}.mw-parser-output .citation .cs1-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/6/65/Lock-green.svg/9px-Lock-green.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .citation .cs1-lock-limited a,.mw-parser-output .citation .cs1-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Lock-gray-alt-2.svg/9px-Lock-gray-alt-2.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .citation .cs1-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Lock-red-alt-2.svg/9px-Lock-red-alt-2.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration{color:#555}.mw-parser-output .cs1-subscription span,.mw-parser-output .cs1-registration span{border-bottom:1px dotted;cursor:help}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Wikisource-logo.svg/12px-Wikisource-logo.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output code.cs1-code{color:inherit;background:inherit;border:inherit;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;font-size:100%}.mw-parser-output .cs1-visible-error{font-size:100%}.mw-parser-output .cs1-maint{display:none;color:#33aa33;margin-left:0.3em}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration,.mw-parser-output .cs1-format{font-size:95%}.mw-parser-output .cs1-kern-left,.mw-parser-output .cs1-kern-wl-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right,.mw-parser-output .cs1-kern-wl-right{padding-right:0.2em}
^ Liz, Crowcroft; et al. (2005). "A survey and comparison of peer-to-peer overlay network schemes". IEEE Communications Surveys & Tutorials. 7 (2): 72–93.
^ Richter, Stevenson; et al. (2009). "Analysis of the impact of dynamic querying models on client-server relationships". Trends in Modern Computing: 682–701.
^ Searching in a Small World Chapters 1 & 2 (PDF), retrieved 2012-01-10
^ "Section 5.2.2", A Distributed Decentralized Information Storage and Retrieval System (PDF), retrieved 2012-01-10
^ Ratnasamy; et al. (2001). "A Scalable Content-Addressable Network" (PDF). In Proceedings of ACM SIGCOMM 2001. Retrieved 2013-05-20.
^ Hari Balakrishnan, M. Frans Kaashoek, David Karger, Robert Morris, and Ion Stoica. Looking up data in P2P systems. In Communications of the ACM, February 2003.
^ David Cohen (October 1, 2002). "New P2P network funded by US government". New Scientist. Retrieved November 10, 2013.
^ "MIT, Berkeley, ICSI, NYU, and Rice Launch the IRIS Project". Press release. MIT. September 25, 2002. Archived from the original on September 26, 2015. Retrieved November 10, 2013.
^ Guido Urdaneta, Guillaume Pierre and Maarten van Steen. A Survey of DHT Security Techniques. ACM Computing Surveys 43(2), January 2011.
^ Singh, Raman; et al. (2017). Advanced Informatics for Computing Research: First International Conference, ICAICR 2017. Springer. pp. 60–79.
^ Moni Naor and Udi Wieder. Novel Architectures for P2P Applications: the Continuous-Discrete Approach. Proc. SPAA, 2003.
^ Gurmeet Singh Manku. Dipsea: A Modular Distributed Hash Table Archived 2004-09-10 at the Wayback Machine. Ph. D. Thesis (Stanford University), August 2004.
^ Forestiero, Agostino; Leonardi, Emilio; Mastroianni, Carlo; Meo, Michela (October 2010). "Self-Chord: A Bio-Inspired P2P Framework for Self-Organizing Distributed Systems". IEEE/ACM Transactions on Networking. 18 (5): 1651–1664. doi:10.1109/TNET.2010.2046745.|access-date=
requires|url=
(help)
^ The (Degree,Diameter) Problem for Graphs, Maite71.upc.es, retrieved 2012-01-10
^ Gurmeet Singh Manku, Moni Naor, and Udi Wieder. Know thy Neighbor's Neighbor: the Power of Lookahead in Randomized P2P Networks. Proc. STOC, 2004.
^ Ali Ghodsi. Distributed k-ary System: Algorithms for Distributed Hash Tables Archived 22 May 2007 at the Wayback Machine. KTH-Royal Institute of Technology, 2006.
^ Castro, Miguel; Costa, Manuel; Rowstron, Antony (1 January 2004). "Should we build Gnutella on a structured overlay?". ACM SIGCOMM Computer Communication Review. 34 (1): 131. doi:10.1145/972374.972397.|access-date=
requires|url=
(help)
^ Talia, Domenico; Trunfio, Paolo (December 2010). "Enabling Dynamic Querying over Distributed Hash Tables". Journal of Parallel and Distributed Computing. 70 (12): 1254–1265. doi:10.1016/j.jpdc.2010.08.012.|access-date=
requires|url=
(help)
^
Baruch Awerbuch, Christian Scheideler.
"Towards a scalable and robust DHT".
2006.
doi:10.1145/1148109.1148163
^
Maxwell Young; Aniket Kate; Ian Goldberg; Martin Karsten.
"Practical Robust Communication in DHTs Tolerating a Byzantine Adversary".
^
Natalya Fedotova; Giordano Orzetti; Luca Veltri; Alessandro Zaccagnini.
"Byzantine agreement for reputation management in DHT-based peer-to-peer networks".
doi:10.1109/ICTEL.2008.4652638
^ Chris Lesniewski-Laas. "A Sybil-proof one-hop DHT" (PDF): 20.
^ Jonathan Kelner, Petar Maymounkov. "Electric routing and concurrent flow cutting". arXiv:0909.2859. Bibcode:2009arXiv0909.2859K.
^ Tribler wiki Archived December 4, 2010, at the Wayback Machine retrieved January 2010.
^ Retroshare FAQ retrieved December 2011
External links
Distributed Hash Tables, Part 1 by Brandon Wiley.
Distributed Hash Tables links Carles Pairot's Page on DHT and P2P research
kademlia.scs.cs.nyu.edu Archive.org snapshots of kademlia.scs.cs.nyu.edu
Eng-Keong Lua; Crowcroft, Jon; Pias, Marcelo; Sharma, Ravi; Lim, Steve. "IEEE Survey on overlay network schemes". CiteSeerX 10.1.1.111.4197: covering unstructured and structured decentralized overlay networks including DHTs (Chord, Pastry, Tapestry and others).
Mainline DHT Measurement at Department of Computer Science, University of Helsinki, Finland.