Package akka.cluster

Class GossipTargetSelector


  • public class GossipTargetSelector
    extends java.lang.Object
    Select n random nodes to gossip to (used to quickly inform the rest of the cluster when leaving for example)
    • Constructor Detail

      • GossipTargetSelector

        public GossipTargetSelector​(double reduceGossipDifferentViewProbability,
                                    double crossDcGossipProbability)
    • 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)
      • 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)
        Select n 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)