Interface ModularLoadManager
- All Known Implementing Classes:
ModularLoadManagerImpl
public interface ModularLoadManager
New proposal for a load manager interface which attempts to use more intuitive method names and provide a starting
place for new load manager proposals.
-
Method Summary
Modifier and TypeMethodDescriptionvoidAs the leader broker, attempt to automatically detect and split hot namespace bundles.voidAs any broker, disable the broker this manager is running on.voidAs the leader broker, select bundles for the namespace service to unload so that they may be reassigned to new brokers.Get available broker list in cluster.Get available broker list in cluster by async invoke.org.apache.pulsar.policies.data.loadbalancer.LocalBrokerDatagetBrokerLocalData(String broker) Fetch local-broker data from load-manager broker cache.org.apache.pulsar.policies.data.loadbalancer.BundleDatagetBundleDataOrDefault(String bundle) Fetch bundle's load report data.List<org.apache.pulsar.common.stats.Metrics>Fetch load balancing metrics.voidinitialize(PulsarService pulsar) Initialize this load manager using the given pulsar service.selectBrokerForAssignment(org.apache.pulsar.common.naming.ServiceUnitId serviceUnit) As the leader broker, find a suitable broker for the assignment of the given bundle.voidstart()As any broker, start the load manager.voidstop()As any broker, stop the load manager.org.apache.pulsar.policies.data.loadbalancer.LocalBrokerDataAs any broker, retrieve the namespace bundle stats and system resource usage to update data local to this broker.voidAs any broker, write the local broker data to ZooKeeper.default voidwriteBrokerDataOnZooKeeper(boolean force) As any broker, write the local broker data to ZooKeeper, forced or not.voidAs the leader broker, write bundle data aggregated from all brokers to ZooKeeper.
-
Method Details
-
disableBroker
void disableBroker() throws org.apache.pulsar.broker.PulsarServerExceptionAs any broker, disable the broker this manager is running on.- Throws:
org.apache.pulsar.broker.PulsarServerException- If ZooKeeper failed to disable the broker.
-
doLoadShedding
void doLoadShedding()As the leader broker, select bundles for the namespace service to unload so that they may be reassigned to new brokers. -
checkNamespaceBundleSplit
void checkNamespaceBundleSplit()As the leader broker, attempt to automatically detect and split hot namespace bundles. -
initialize
Initialize this load manager using the given pulsar service. -
selectBrokerForAssignment
Optional<String> selectBrokerForAssignment(org.apache.pulsar.common.naming.ServiceUnitId serviceUnit) As the leader broker, find a suitable broker for the assignment of the given bundle.- Parameters:
serviceUnit- ServiceUnitId for the bundle.- Returns:
- The name of the selected broker, as it appears on ZooKeeper.
-
start
void start() throws org.apache.pulsar.broker.PulsarServerExceptionAs any broker, start the load manager.- Throws:
org.apache.pulsar.broker.PulsarServerException- If an unexpected error prevented the load manager from being started.
-
stop
void stop() throws org.apache.pulsar.broker.PulsarServerExceptionAs any broker, stop the load manager.- Throws:
org.apache.pulsar.broker.PulsarServerException- If an unexpected error occurred when attempting to stop the load manager.
-
updateLocalBrokerData
org.apache.pulsar.policies.data.loadbalancer.LocalBrokerData updateLocalBrokerData()As any broker, retrieve the namespace bundle stats and system resource usage to update data local to this broker. -
writeBrokerDataOnZooKeeper
void writeBrokerDataOnZooKeeper()As any broker, write the local broker data to ZooKeeper. -
writeBrokerDataOnZooKeeper
default void writeBrokerDataOnZooKeeper(boolean force) As any broker, write the local broker data to ZooKeeper, forced or not. -
writeBundleDataOnZooKeeper
void writeBundleDataOnZooKeeper()As the leader broker, write bundle data aggregated from all brokers to ZooKeeper. -
getAvailableBrokers
Get available broker list in cluster.- Returns:
-
getAvailableBrokersAsync
CompletableFuture<Set<String>> getAvailableBrokersAsync()Get available broker list in cluster by async invoke. -
getBrokerLocalData
Fetch local-broker data from load-manager broker cache.- Parameters:
broker- load-balancer path- Returns:
-
getLoadBalancingMetrics
List<org.apache.pulsar.common.stats.Metrics> getLoadBalancingMetrics()Fetch load balancing metrics.- Returns:
- List of LoadBalancing Metrics
-
getBundleDataOrDefault
Fetch bundle's load report data.- Parameters:
bundle-- Returns:
- bundle data
-