Class WRRPlacementStrategy

java.lang.Object
org.apache.pulsar.broker.loadbalance.impl.WRRPlacementStrategy
All Implemented Interfaces:
PlacementStrategy

public class WRRPlacementStrategy extends Object implements PlacementStrategy
This class implements PlacementStrategy based on Weighted Round Robin Algorithm.
  • Constructor Details

    • WRRPlacementStrategy

      public WRRPlacementStrategy()
  • Method Details

    • findBrokerForPlacement

      public ResourceUnit findBrokerForPlacement(com.google.common.collect.Multimap<Long,ResourceUnit> finalCandidates)
      Function : getByWeightedRoundRobin returns ResourceUnit selected by WRR algorithm based on available resource on RU. <code> ^ | | | | | | | | | | | | | | Broker 2 | Broker 3 | Broker 1 | B4 | | | | | | +----------------+------------------------+--------------------------------+--------- 0 20 50 90 100 This is weighted Round robin, we calculate weight based on availability of resources; total availability is taken as a full range then each broker is given range based on its resource availability, if the number generated within total range happens to be in broker's range, that broker is selected </code>
      Specified by:
      findBrokerForPlacement in interface PlacementStrategy