Class ThresholdShedder
java.lang.Object
org.apache.pulsar.broker.loadbalance.impl.ThresholdShedder
- All Implemented Interfaces:
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:
LocalBrokerData.getMaxResourceUsageWithWeight(double, double, double, double, double). 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.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindBundlesForUnloading(LoadData loadData, org.apache.pulsar.broker.ServiceConfiguration conf) Recommend that all of the returned bundles be unloaded.voidonActiveBrokersChange(Set<String> newBrokers) Triggered when active broker changes.
-
Constructor Details
-
ThresholdShedder
public ThresholdShedder()
-
-
Method Details
-
findBundlesForUnloading
public com.google.common.collect.Multimap<String,String> findBundlesForUnloading(LoadData loadData, org.apache.pulsar.broker.ServiceConfiguration conf) Description copied from interface:LoadSheddingStrategyRecommend that all of the returned bundles be unloaded.- 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.
-
onActiveBrokersChange
Description copied from interface:LoadSheddingStrategyTriggered when active broker changes.- Specified by:
onActiveBrokersChangein interfaceLoadSheddingStrategy- Parameters:
newBrokers- active Brokers
-