Class LeastResourceUsageWithWeight

java.lang.Object
org.apache.pulsar.broker.loadbalance.impl.LeastResourceUsageWithWeight
All Implemented Interfaces:
ModularLoadManagerStrategy

public class LeastResourceUsageWithWeight extends Object implements ModularLoadManagerStrategy
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

    • selectBroker

      public Optional<String> selectBroker(Set<String> candidates, org.apache.pulsar.policies.data.loadbalancer.BundleData bundleToAssign, LoadData loadData, org.apache.pulsar.broker.ServiceConfiguration conf)
      Find a suitable broker to assign the given bundle to. This method is not thread safety.
      Specified by:
      selectBroker in interface ModularLoadManagerStrategy
      Parameters:
      candidates - The candidates for which the bundle may be assigned.
      bundleToAssign - The data for the bundle to assign.
      loadData - The load data from the leader broker.
      conf - The service configuration.
      Returns:
      The name of the selected broker as it appears on ZooKeeper.