Class ThresholdShedder

  • All Implemented Interfaces:
    LoadSheddingStrategy

    public class ThresholdShedder
    extends java.lang.Object
    implements LoadSheddingStrategy
    Load shedding strategy that unloads any broker that exceeds the average resource utilization of all brokers by a configured threshold. As a consequence, this strategy tends to distribute load among all brokers. It does this by first computing the average resource usage per broker for the whole cluster. The resource usage for each broker is calculated using the following method: {@link LocalBrokerData#getMaxResourceUsageWithWeight)}. The weights for each resource are configurable. Historical observations are included in the running average based on the broker's setting for loadBalancerHistoryResourcePercentage. Once the average resource usage is calculated, a broker's current/historical usage is compared to the average broker usage. If a broker's usage is greater than the average usage per broker plus the loadBalancerBrokerThresholdShedderPercentage, this load shedder proposes removing enough bundles to bring the unloaded broker 5% below the current average broker usage. Note that recently unloaded bundles are not unloaded again.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.google.common.collect.Multimap<java.lang.String,​java.lang.String> findBundlesForUnloading​(LoadData loadData, org.apache.pulsar.broker.ServiceConfiguration conf)
      Recommend that all of the returned bundles be unloaded.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ThresholdShedder

        public ThresholdShedder()
    • Method Detail

      • findBundlesForUnloading

        public com.google.common.collect.Multimap<java.lang.String,​java.lang.String> findBundlesForUnloading​(LoadData loadData,
                                                                                                                   org.apache.pulsar.broker.ServiceConfiguration conf)
        Description copied from interface: LoadSheddingStrategy
        Recommend that all of the returned bundles be unloaded.
        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 all selected bundles to the brokers on which they reside.