The principle of Structured Peer-to-peer network--DHT Network
Source: Internet
Author: User
Peer-to-peer systems are increasingly widely used in file sharing, streaming media services, instant messaging, computing and storage capacity sharing, and collaborative processing and services to see the existence of Peer-to-peer, some peer-to-peer applications such as Napster, EMule, BitTorrent, etc. have long been well-known.
Peer-to-peer according to its topological relationship can be roughly divided into two types of four forms:
1. Unstructured topology. Including the central topology, distributed topology, semi-distributed topology, which corresponds to Napster, BitTorrent, Kazaa these three well-known applications.
2. Structured topology. The main form is a distributed structured topology, known as a DHT network.
dht--distributed hash Table distributed hash table:
1. The hash table is divided into discontinuous blocks, each node being assigned to a hash block of its own and becoming the manager of this Hashi.
2. By encrypting the hash function, an object's name or keyword is mapped to a 128-bit or 160-bit hash value.
The basic idea of the DHT network is as follows:
1. Each resource is identified by a set of keywords.
2. The system hash Each of these keywords, according to the results of the hash to determine the corresponding information (that is, one of the resource index) by which user is responsible for storage.
3. When users search, use the same algorithm to calculate the hash of each keyword, so as to obtain the corresponding information storage location of the key, and quickly locate resources.
On how this network works, see:
DHT Network crawler in Peer-to-peerand wrote a
Magnetic Search's Web page.
DHT keyword positioning:
1.DHT through a distributed hash function, the input keyword is uniquely mapped to a node, and then a connection is established with the node through some routing algorithms.
2. Each node does not need to save the entire system's node view information, only in the node to store its neighboring several successor node information, when a node receives a query operation, if it found that the identity of the query is not in its own associated interval, The node will send the query to the neighbor in its storage node information table that it thinks is closest to the target.
3. Each forwarding can be further closer to the data source. Therefore, less routing information can be effectively achieved to reach the target node.
DHT's specific algorithm implementation process:
(1) Hash the characteristics of each node, such as IP address, so that the node value of each node is unique. The nodes are formed into a ring (chord ring) according to the node value from small to large. (The node value here can be seen as the IP address in the new ring)
(2) The distance between each node and the next adjacent node is obtained by means of the node value, thus obtaining the required value interval for each node. (This procedure is similar to establishing a routing table)
(3) on each node of the resource extraction keyword, and the keyword hash, the resulting hash value according to (2) each node in charge of the interval to allocate, so that each resource storage information is stored on a node. (This step gets the index list of resources)
(4) When searching for a resource, the key word is hashed, the value obtained is compared with the value interval table of the current node, thus obtaining the node that the resource index information is most likely to exist. Queries the node, gets the index of the resource, and, depending on the index, finds the node where the resource resides and establishes the communication.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.