节点如何知道哪些节点看到了集群的当前状态?

How does node know which nodes have seen the cluster current state?

我正在阅读 akka 文档,并在理解他们实施 Gossip 的方式时遇到了一些麻烦。 (docs here)。令我困惑的部分,(强调我的):

Periodically, the default is every 1 second, each node chooses another random node to initiate a round of gossip with. If less than ½ of the nodes resides in the seen set (have seen the new state) then the cluster gossips 3 times instead of once every second. This adjusted gossip interval is a way to speed up the convergence process in the early dissemination phase after a state change.

因此,如果 gossip 轮在开始时(少于 ½ 个节点看到了当前状态),已见集合中的节点开始每秒发送 3 个 gossip,而不是一个。但是,如果八卦收敛发生了,他们怎么知道的(他们仍然每秒发送 3 次八卦)。或者也许收敛在整个集群中传播,就像任何其他 "cluster event"?

正如你所知,八卦收敛发生在所有节点都被看到时(即所有成员节点都在八卦事件的可见列表中)。如果集群未收敛,ClusterDeamon 会加速八卦。

def gossipTick(): Unit = {
    gossip()
    if (isGossipSpeedupNeeded) {
      scheduler.scheduleOnce(GossipInterval / 3, self, GossipSpeedupTick)
      scheduler.scheduleOnce(GossipInterval * 2 / 3, self, GossipSpeedupTick)
    }
  }

def isGossipSpeedupNeeded: Boolean =
    (latestGossip.overview.seen.size < latestGossip.members.size / 2)

集群收敛后,它会使用配置的八卦间隔回退到正常的预定八卦滴答。查看此功能的 source and test specs。希望这可以帮助。

正如您在 中回答的那样,当节点八卦时,它们包括哪些其他节点已经看到此更新。

注意八卦随机选择要八卦的节点。虽然这个系统实现了一个加权随机优先于那些还没有看到更新的节点,节点仍然可以与其他没有的节点闲聊看到了更新。当这种情况发生时,看到的集合会在一对八卦节点上更新。

节点本质上是在八卦这个值,然后八卦谁看到了这个值。为了简单起见,该协议实际上将这两个概念捆绑在一起。