Class DeviationShedder

  • All Implemented Interfaces:
    LoadSheddingStrategy

    public abstract class DeviationShedder
    extends java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.TreeSet<org.apache.commons.lang3.tuple.Pair<java.lang.Double,​java.lang.String>> bundleTreeSetCache  
      protected java.util.TreeSet<org.apache.commons.lang3.tuple.Pair<java.lang.Double,​java.lang.String>> metricTreeSetCache  
    • Constructor Summary

      Constructors 
      Constructor Description
      DeviationShedder()
      Initialize this DeviationShedder.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract double brokerValue​(BrokerData brokerData, org.apache.pulsar.broker.ServiceConfiguration conf)  
      protected abstract double bundleValue​(java.lang.String bundle, BrokerData brokerData, org.apache.pulsar.broker.ServiceConfiguration conf)  
      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 based on observing excessive standard deviations according to some metric.
      protected abstract double getDeviationThreshold​(org.apache.pulsar.broker.ServiceConfiguration conf)  
      • Methods inherited from class java.lang.Object

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

      • metricTreeSetCache

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

        protected java.util.TreeSet<org.apache.commons.lang3.tuple.Pair<java.lang.Double,​java.lang.String>> bundleTreeSetCache
    • Constructor Detail

      • DeviationShedder

        public DeviationShedder()
        Initialize this DeviationShedder.
    • Method Detail

      • bundleValue

        protected abstract double bundleValue​(java.lang.String bundle,
                                              BrokerData brokerData,
                                              org.apache.pulsar.broker.ServiceConfiguration conf)
      • brokerValue

        protected abstract double brokerValue​(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<java.lang.String,​java.lang.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.