Interface LoadManager
- All Known Implementing Classes:
ModularLoadManagerWrapper,NoopLoadManager,SimpleLoadManagerImpl
public interface LoadManager
LoadManager runs through set of load reports collected from different brokers and generates a recommendation of
namespace/ServiceUnit placement on machines/ResourceUnit. Each Concrete Load Manager will use different algorithms to
generate this mapping.
Concrete Load Manager is also return the least loaded broker that should own the new namespace.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic LoadManagercreate(PulsarService pulsar) voidRemoves visibility of current broker from loadbalancer list so, other brokers can't redirect any request to this broker and this broker won't accept new connection requests.voidUnload a candidate service unit to balance the load.voidNamespace bundle split.org.apache.pulsar.policies.data.loadbalancer.LoadManagerReportGenerate the load report.Get list of available brokers in cluster.getLeastLoaded(org.apache.pulsar.common.naming.ServiceUnitId su) Returns the Least Loaded Resource Unit decided by some algorithm or criteria which is implementation specific.List<org.apache.pulsar.common.stats.Metrics>Generate load balancing stats metrics.voidinitialize(PulsarService pulsar) Initialize this LoadManager.booleanIs centralized decision making to assign a new bundle.voidSet flag to force load report update.voidstart()voidstop()voidPublish the current load report on ZK.default voidwriteLoadReportOnZookeeper(boolean force) Publish the current load report on ZK, forced or not.voidUpdate namespace bundle resource quota on ZK.
-
Field Details
-
LOG
static final org.slf4j.Logger LOG -
LOADBALANCE_BROKERS_ROOT
- See Also:
-
-
Method Details
-
start
void start() throws org.apache.pulsar.broker.PulsarServerException- Throws:
org.apache.pulsar.broker.PulsarServerException
-
isCentralized
boolean isCentralized()Is centralized decision making to assign a new bundle. -
getLeastLoaded
Optional<ResourceUnit> getLeastLoaded(org.apache.pulsar.common.naming.ServiceUnitId su) throws Exception Returns the Least Loaded Resource Unit decided by some algorithm or criteria which is implementation specific.- Throws:
Exception
-
generateLoadReport
org.apache.pulsar.policies.data.loadbalancer.LoadManagerReport generateLoadReport() throws ExceptionGenerate the load report.- Throws:
Exception
-
setLoadReportForceUpdateFlag
void setLoadReportForceUpdateFlag()Set flag to force load report update. -
writeLoadReportOnZookeeper
Publish the current load report on ZK.- Throws:
Exception
-
writeLoadReportOnZookeeper
Publish the current load report on ZK, forced or not. By default rely on method writeLoadReportOnZookeeper().- Throws:
Exception
-
writeResourceQuotasToZooKeeper
Update namespace bundle resource quota on ZK.- Throws:
Exception
-
getLoadBalancingMetrics
List<org.apache.pulsar.common.stats.Metrics> getLoadBalancingMetrics()Generate load balancing stats metrics. -
doLoadShedding
void doLoadShedding()Unload a candidate service unit to balance the load. -
doNamespaceBundleSplit
Namespace bundle split.- Throws:
Exception
-
disableBroker
Removes visibility of current broker from loadbalancer list so, other brokers can't redirect any request to this broker and this broker won't accept new connection requests.- Throws:
Exception
-
getAvailableBrokers
Get list of available brokers in cluster.- Returns:
- Throws:
Exception
-
getAvailableBrokersAsync
CompletableFuture<Set<String>> getAvailableBrokersAsync() -
stop
void stop() throws org.apache.pulsar.broker.PulsarServerException- Throws:
org.apache.pulsar.broker.PulsarServerException
-
initialize
Initialize this LoadManager.- Parameters:
pulsar- The service to initialize this with.
-
create
-