Class OverloadShedder

java.lang.Object
org.apache.pulsar.broker.loadbalance.impl.OverloadShedder
All Implemented Interfaces:
LoadSheddingStrategy

public class OverloadShedder extends Object implements LoadSheddingStrategy
Load shedding strategy which will attempt to shed exactly one bundle on brokers which are overloaded, that is, whose maximum system resource usage exceeds loadBalancerBrokerOverloadedThresholdPercentage. To see which resources are considered when determining the maximum system resource, see LocalBrokerData.getMaxResourceUsage(). A bundle is recommended for unloading off that broker if and only if the following conditions hold: The broker has at least two bundles assigned and the broker has at least one bundle that has not been unloaded recently according to LoadBalancerSheddingGracePeriodMinutes. The unloaded bundle will be the most expensive bundle in terms of message rate that has not been recently unloaded. Note that this strategy does not take into account "underloaded" brokers when determining which bundles to unload. If you are looking for a strategy that spreads load evenly across all brokers, see ThresholdShedder.
  • Constructor Details

    • OverloadShedder

      public OverloadShedder()
  • Method Details

    • findBundlesForUnloading

      public com.google.common.collect.Multimap<String,String> findBundlesForUnloading(LoadData loadData, org.apache.pulsar.broker.ServiceConfiguration conf)
      Attempt to shed some bundles off every broker which is overloaded.
      Specified by:
      findBundlesForUnloading in interface LoadSheddingStrategy
      Parameters:
      loadData - The load data to used to make the unloading decision.
      conf - The service configuration.
      Returns:
      A map from bundles to unload to the brokers on which they are loaded.