Chord阅读报告

来源:互联网 发布:卖牛仔裤的淘宝店铺 编辑:程序博客网 时间:2024/05/01 16:59

chord协议
一,概述
chord的核心是提供一种快速的分布式计算方法,该方法通过hash函数将key值定位到存储该key的节点。
1,hash函数能负载均衡。
2,当第n个节点加入或者离开网络的时候,只有O(1/n)的keys需要迁移到另一个节点,这是负载均衡所需要的最少的费用。
3,在一个有n个节点的chord网络中,每个节点仅仅需要维护O(log(n))个节点的信息,这大大提高了可扩展性。

二,一致hash
 节点和key都有自己的identifier,一个m-bit的标识。
一致hash按照如下的方式将keys赋给node:将identifier由小到大按顺时针排成一个环,key赋给换上顺时针方向identifier值最接近key的那个node。且该node称为successor(key)。即每个key都赋给successor(key)。
 当节点n加入和离开chord网络的时候,一致hash能维护最小损害:某些特定的key之前是赋给n的successor的,现在要转移给n,当n离开的时候,它仅仅需要将key值转移到n的successor。而不需要其他任何的更改。

 

三. Simple Key Location
 This section describes a simple but slow Chord lookup algorithm. Succeeding sections will describe how to extend the basic algorithm to increase efficiency, and how to maintain the correctness of Chord’s routing information.
 Lookups could be implemented on a Chord ring with little per-node state. Each node need only know how to contact its current successor node on the identifier circle. Queries for a given identifier could be passed around the circle via these successor pointers until they encounter a pair of nodes that straddle the desired identifier; the second in the pair is the node the query
maps to.
 Figure 3(a) shows pseudocode that implements simple key lookup. Remote calls and variable references are preceded by the remote node identifier, while local variable references and procedure calls omit the local node. Thus n.foo() denotes a remote procedure call of procedure foo on node n, while n.bar, without parentheses, is an RPC to fetch a variable bar from node n. The notation (a; b] denotes the segment of the Chord ring obtained by moving clockwise from (but not including) a until reaching (and including) b.
 Figure 3(b) shows an example in which node 8 performs a lookup for key 54. Node 8 invokes find successor for key 54 which eventually returns the successor of that key, node 56. The query visits every node on the circle between nodes 8 and 56. The result returns along the reverse of the path followed by the query.

四:Scalable Key Location
 三所示的查找策略需要花费和节点数接近的线性开销。为了加快查找,每个node需要维护额外的路由信息。三部分:前驱,后继,finger table。正确的路由信息是chord快速稳定比不可少的。
 As before, let m be the number of bits in the key/node identifiers. Each node n maintains a routing table with up tomentries (we will see that in fact only O(log n) are distinct), called the finger table. The ith entry in the table at node n contains the identity of the first node s that succeeds n by at least 2i

原创粉丝点击