9

最近、Kademlia プロトコルのドキュメントを読んで、プロトコルを理解しようとしましたが、まだいくつか疑問があります。IP またはポートではなく、ID を知っているノードが別のノードを見つけなければならないのはなぜですか? IP やポートがわからないのに ID を持っているのはなぜですか。どこで ID を取得したのでしょうか。2 つの異なるノード間の「距離」は、ルーティング距離や実際の距離ではなく、アルゴリズムを使用してノードをすばやく見つけることができる仮想距離にすぎないと思います。そうですか?

英語は私の母国語ではないので、私の英語はあまり明確ではないかもしれませんが、必要に応じて自分自身を明確に表現しようとします. どうもありがとう!

4

2 に答える 2

20

As cHao said, the distributed nature of the network means that nodes need to publish their IDs and their contact details to other nodes they talk to. There is no central place where IDs are mapped to contact info, so each node must keep this mapping for a subset of the nodes on the network in its own routing table.

Kademlia routing tables are structured so that nodes will have detailed knowledge of the network close to them, and exponentially decreasing knowledge further away.

The use of bitwise XOR as a measure of notional distance between IDs has the advantage that for a given target ID, no two IDs can have the same distance to the target.

Imagine a simple example where the IDs are in the range 00 to 63. If Kademlia used e.g. pure mathematical difference as a measure of distance, 15 and 35 would be the same distance to 25 - both would have a distance of 10. Using XOR, the distance between 15 and 25 is 22, and between 25 and 35 it's 58.

In this way, the group of k closest IDs to a target ID can be calculated unambiguously.

The constant k has a couple of uses in Kademlia, but it's primarily the replication factor. In other words, a piece of data is stored on the k closest nodes to the data's ID.

The lookup process is designed to return either a group of k nodes (before storing data on each of them) or return a single piece of data (from the first node holding it during the lookup iterations).

Because of this, pure Kademlia isn't best suited to finding just a single node, so I'm not sure that part of your question is too relevant. If you did want to use Kademlia to find a single node, it would probably be worth modifying the lookup process to finish early as soon as any node returns the target node's contact details (in the same way that the lookup finishes early if a target value is found during the process).

于 2012-02-16T11:30:27.750 に答える
9

ネットワークは分散しているため、定義上、ID->アドレス マッピングのマスター テーブルは 1 つもありません。ノードは、他のすべてのノードについて知る必要はありません (通常は知りません)。ノードを「見つける」プロセスは、基本的に、ターゲットに「最も近い」既知のノードに、直接ターゲット ノードについてではなく、どのノードがターゲットに近いかを尋ねることです。そのクエリの結果は、クエリする次のノードのグループを提供し、プロセスが繰り返されます。ノードは実際よりも近い結果を返すため、各反復は、最終的にターゲットに近いノードを見つける傾向があります。 「ああ、ノード X? 彼はすぐそこにいる」と言うことができるノードに到達します。

少なくともそれは私が理解していることです。

于 2012-02-16T05:40:24.137 に答える