节点如何知道哪些节点已看到群集当前状态? [英] How does node know which nodes have seen the cluster current state?

查看:179
本文介绍了节点如何知道哪些节点已看到群集当前状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在阅读akka文档,但遇到了一些麻烦,难以理解他们实现 八卦 的方式。 ( docs here )。令我感到困惑的部分(重点是我的):

I'm reading akka documentation and come up with some troubles of undertanding the way they implemented Gossip. (docs here). The part that confused me, (emphasized mine):


定期,默认值为每1秒一次,每个节点选择另一个
随机节点发起一轮八卦。 如果少于
个节点中的1/2个位于可见集中(已经看到新状态),则
群集八卦而不是每秒八次。 这种调整后的
八卦间隔是一种在状态更改后加快
早期传播阶段的收敛过程的方法。
p>

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.

因此,如果八卦回合是在开始阶段(少于½个节点已经看到当前状态),则从所看到的集合开始发送节点3秒钟而不是一个闲话。但是,如果八卦融合发生了,他们怎么知道(他们仍然每秒发送八次八卦)。还是可能像其他任何集群事件一样,在整个集群中进行收敛?

So, if the gossip round is in the beginning (less then ½ nodes have seen the current state), the nodes from seen set start sending 3 gossips a second instead of one. But if the gossip convergence happened how do they know about that (they still keep sending gossip 3 times a second). Or maybe convergence is gossiped throughout the cluster just as any other "cluster event"?

推荐答案

正如您可能知道的八卦收敛发生在何时所有节点都可见(即所有成员节点都在Gossip事件的可见列表中)。如果集群未收敛,ClusterDeamon会加快八卦。

As you may know gossip convergence happens when all nodes are seen (i.e all member nodes are in the seen list of Gossip event). If cluster is not converged ClusterDeamon speeds up the gossip.

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 此功能的测试规格。希望这可以帮助。

Once cluster has been converged, it falls back to normal scheduled gossip ticks using configured gossip interval. Have a look at source and test specs of this feature. Hope this helps.

这篇关于节点如何知道哪些节点已看到群集当前状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆