Package akka.cluster
Class GossipTargetSelector
- java.lang.Object
-
- akka.cluster.GossipTargetSelector
-
public class GossipTargetSelector extends java.lang.Object
Selectn
random nodes to gossip to (used to quickly inform the rest of the cluster when leaving for example)
-
-
Constructor Summary
Constructors Constructor Description GossipTargetSelector(double reduceGossipDifferentViewProbability, double crossDcGossipProbability)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
adjustedGossipDifferentViewProbability(int clusterSize)
For large clusters we should avoid shooting down individual nodes.protected scala.collection.immutable.List<java.lang.String>
dcsInRandomOrder(scala.collection.immutable.List<java.lang.String> dcs)
scala.Option<UniqueAddress>
gossipTarget(MembershipState state)
scala.collection.immutable.Vector<UniqueAddress>
gossipTargets(MembershipState state)
protected scala.collection.immutable.Vector<UniqueAddress>
localDcGossipTargets(MembershipState state)
Chooses a set of possible gossip targets that is in the same dc.protected scala.collection.immutable.Vector<UniqueAddress>
multiDcGossipTargets(MembershipState state)
Choose cross-dc nodes if this one of the N oldest nodes, and if not fall back to gossip locally in the dcprotected boolean
preferNodesWithDifferentView(MembershipState state)
scala.collection.immutable.Vector<UniqueAddress>
randomNodesForFullGossip(MembershipState state, int n)
Selectn
random nodes to gossip to (used to quickly inform the rest of the cluster when leaving for example)protected boolean
selectDcLocalNodes(MembershipState state)
For small DCs prefer cross DC gossip.protected scala.Option<UniqueAddress>
selectRandomNode(scala.collection.IndexedSeq<UniqueAddress> nodes)
-
-
-
Method Detail
-
adjustedGossipDifferentViewProbability
protected double adjustedGossipDifferentViewProbability(int clusterSize)
For large clusters we should avoid shooting down individual nodes. Therefore the probability is reduced for large clusters.- Parameters:
clusterSize
- (undocumented)- Returns:
- (undocumented)
-
dcsInRandomOrder
protected scala.collection.immutable.List<java.lang.String> dcsInRandomOrder(scala.collection.immutable.List<java.lang.String> dcs)
-
gossipTarget
public final scala.Option<UniqueAddress> gossipTarget(MembershipState state)
-
gossipTargets
public final scala.collection.immutable.Vector<UniqueAddress> gossipTargets(MembershipState state)
-
localDcGossipTargets
protected scala.collection.immutable.Vector<UniqueAddress> localDcGossipTargets(MembershipState state)
Chooses a set of possible gossip targets that is in the same dc. If the cluster is not multi dc this means it is a choice among all nodes of the cluster.- Parameters:
state
- (undocumented)- Returns:
- (undocumented)
-
multiDcGossipTargets
protected scala.collection.immutable.Vector<UniqueAddress> multiDcGossipTargets(MembershipState state)
Choose cross-dc nodes if this one of the N oldest nodes, and if not fall back to gossip locally in the dc- Parameters:
state
- (undocumented)- Returns:
- (undocumented)
-
preferNodesWithDifferentView
protected boolean preferNodesWithDifferentView(MembershipState state)
-
randomNodesForFullGossip
public scala.collection.immutable.Vector<UniqueAddress> randomNodesForFullGossip(MembershipState state, int n)
Selectn
random nodes to gossip to (used to quickly inform the rest of the cluster when leaving for example)- Parameters:
state
- (undocumented)n
- (undocumented)- Returns:
- (undocumented)
-
selectDcLocalNodes
protected boolean selectDcLocalNodes(MembershipState state)
For small DCs prefer cross DC gossip. This speeds up the bootstrapping of new DCs as adding an initial node means it has no local peers. Once the DC is at 5 members use the configured crossDcGossipProbability, before that for a single node cluster use 1.0, two nodes use 0.75 etc- Parameters:
state
- (undocumented)- Returns:
- (undocumented)
-
selectRandomNode
protected scala.Option<UniqueAddress> selectRandomNode(scala.collection.IndexedSeq<UniqueAddress> nodes)
-
-