简单的说Kademlia只是一项技术准则(通常称其为第3代P2P技术),DHT则是该技术的具体实现。(如eMule中也有基于Kademlia技术的KAD实现)。Kademlia is a P2P overlay protocol designed by Petar Maymounkov and David Mazières, for decentralized peer to peer computer networks. It specifies the structure of the network, regulates communication between nodes and how the exchange of information has to take place. Kademlia nodes communicate among themselves using the transport protocol UDP (see OSI model). Kademlia nodes store data by implementing a Distributed Hash Table (DHT). Over an existing LAN/WAN (like the Internet) a new, virtual network, is created in which each network node is identified by a number ("Node ID"). This number serves not only as its identification, but the Kademlia algorithm uses it for further purposes. 具体的技术细节这里不过多描述,有兴趣的用户可以自行参考相关的资料。那么,为什么要在BT里引入基于Kademlia的公有DHT网络?在传统的BT下载里,所有的种子文件都必须指定一个或多个种子服务器,即通常所说的Tracker或Announce地址。而一旦该种子服务器当机或由于其它原因停摆(比如:前不久我们的前服务商违约,强行拔掉我们的服务器的网线),BT用户很可能就无法完成该种子文件的上传与下载。在传统BT下载里,还有如下情况:有两个完全相同的种子文件,但是由于指定了不同的Tracker,所以不同Tracker的用户之间无法进行下载与上传,从而不能充分体现BT的下载/上传效率。而引入公有DHT网络后,即使种子服务器当机(或者说根本不需要种子服务器的参与),BT用户仍然可以通过DHT网络来获取连接,从而实现下载与上传。那么这些连接信息是保存在哪里的呢?简单来说,这些连接信息保存在根据一定的算法挑选出的DHT网络参与者(即DHT节点)之间,也就是说,一旦你加入公有DHT网络,你就会有一个ID(该ID只是程序生成的、虚拟的、完全随机的ID,与你的实际个人信息没有任何联系,请完全放心),根据一定的规则,你需要负责维护一部分种子文件的连接信息,相当于你同时也是一个轻量级种子服务器。由于涉及到一些数据通信流量,可能会对你的网络产生轻微的负担或影响,不过,与加入公有DHT网络带来的回报比起来,该影响是完全可以忽略的