Class DeviationShedder

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

public abstract class DeviationShedder extends Object implements LoadSheddingStrategy
An abstract class which makes a LoadSheddingStrategy which makes decisions based on standard deviation easier to implement. Assuming there exists some real number metric which may estimate the load on a server, this load shedding strategy calculates the standard deviation with respect to that metric and sheds load on brokers whose standard deviation is above some threshold.
  • Field Details

    • metricTreeSetCache

      protected TreeSet<org.apache.commons.lang3.tuple.Pair<Double,String>> metricTreeSetCache
    • bundleTreeSetCache

      protected TreeSet<org.apache.commons.lang3.tuple.Pair<Double,String>> bundleTreeSetCache
  • Constructor Details

    • DeviationShedder

      public DeviationShedder()
      Initialize this DeviationShedder.
  • Method Details

    • bundleValue

      protected abstract double bundleValue(String bundle, org.apache.pulsar.policies.data.loadbalancer.BrokerData brokerData, org.apache.pulsar.broker.ServiceConfiguration conf)
    • brokerValue

      protected abstract double brokerValue(org.apache.pulsar.policies.data.loadbalancer.BrokerData brokerData, org.apache.pulsar.broker.ServiceConfiguration conf)
    • getDeviationThreshold

      protected abstract double getDeviationThreshold(org.apache.pulsar.broker.ServiceConfiguration conf)
    • findBundlesForUnloading

      public com.google.common.collect.Multimap<String,String> findBundlesForUnloading(LoadData loadData, org.apache.pulsar.broker.ServiceConfiguration conf)
      Recommend that all of the returned bundles be unloaded based on observing excessive standard deviations according to some metric.
      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.