Class LeastResourceUsageWithWeight

java.lang.Object
org.apache.pulsar.broker.loadbalance.extensions.strategy.LeastResourceUsageWithWeight
All Implemented Interfaces:
BrokerSelectionStrategy

@ThreadSafe public class LeastResourceUsageWithWeight extends Object implements BrokerSelectionStrategy
Placement strategy which selects a broker based on which one has the least resource usage with weight. This strategy takes into account the historical load percentage and short-term load percentage, and thus will not cause cluster fluctuations due to short-term load jitter.
  • Constructor Details

    • LeastResourceUsageWithWeight

      public LeastResourceUsageWithWeight()
  • Method Details

    • select

      public Optional<String> select(Set<String> candidates, org.apache.pulsar.common.naming.ServiceUnitId bundleToAssign, LoadManagerContext context)
      Find a suitable broker to assign the given bundle to.
      Specified by:
      select in interface BrokerSelectionStrategy
      Parameters:
      candidates - The candidates for which the bundle may be assigned.
      bundleToAssign - The data for the bundle to assign.
      context - The load manager context.
      Returns:
      The name of the selected broker as it appears on ZooKeeper.