Class DeviationShedder
- java.lang.Object
-
- org.apache.pulsar.broker.loadbalance.impl.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>>bundleTreeSetCacheprotected 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 doublebrokerValue(BrokerData brokerData, org.apache.pulsar.broker.ServiceConfiguration conf)protected abstract doublebundleValue(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 doublegetDeviationThreshold(org.apache.pulsar.broker.ServiceConfiguration conf)
-
-
-
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:
findBundlesForUnloadingin interfaceLoadSheddingStrategy- 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.
-
-