Class AvgShedder
java.lang.Object
org.apache.pulsar.broker.loadbalance.impl.AvgShedder
- All Implemented Interfaces:
LoadSheddingStrategy,ModularLoadManagerStrategy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindBundlesForUnloading(LoadData loadData, ServiceConfiguration conf) Recommend that all of the returned bundles be unloaded.voidonActiveBrokersChange(Set<String> activeBrokers) Triggered when active broker changes.selectBroker(Set<String> candidates, org.apache.pulsar.policies.data.loadbalancer.BundleData bundleToAssign, LoadData loadData, ServiceConfiguration conf) Find a suitable broker to assign the given bundle to.
-
Constructor Details
-
AvgShedder
public AvgShedder()
-
-
Method Details
-
findBundlesForUnloading
public com.google.common.collect.Multimap<String,String> findBundlesForUnloading(LoadData loadData, 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- Specified by:
onActiveBrokersChangein interfaceModularLoadManagerStrategy- Parameters:
activeBrokers- active Brokers
-
selectBroker
public Optional<String> selectBroker(Set<String> candidates, org.apache.pulsar.policies.data.loadbalancer.BundleData bundleToAssign, LoadData loadData, ServiceConfiguration conf) Description copied from interface:ModularLoadManagerStrategyFind a suitable broker to assign the given bundle to.- Specified by:
selectBrokerin interfaceModularLoadManagerStrategy- Parameters:
candidates- The candidates for which the bundle may be assigned.bundleToAssign- The data for the bundle to assign.loadData- The load data from the leader broker.conf- The service configuration.- Returns:
- The name of the selected broker as it appears on ZooKeeper.
-