Interface LoadManager
-
- All Known Implementing Classes:
ModularLoadManagerWrapper,NoopLoadManager,SimpleLoadManagerImpl
public interface LoadManagerLoadManager 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 Modifier and Type Field Description static java.lang.StringLOADBALANCE_BROKERS_ROOTstatic org.slf4j.LoggerLOG
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static LoadManagercreate(PulsarService pulsar)voiddisableBroker()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.voiddoLoadShedding()Unload a candidate service unit to balance the load.voiddoNamespaceBundleSplit()Namespace bundle split.org.apache.pulsar.policies.data.loadbalancer.LoadManagerReportgenerateLoadReport()Generate the load report.java.util.Set<java.lang.String>getAvailableBrokers()Get list of available brokers in cluster.java.util.Optional<ResourceUnit>getLeastLoaded(org.apache.pulsar.common.naming.ServiceUnitId su)Returns the Least Loaded Resource Unit decided by some algorithm or criteria which is implementation specific.java.util.List<org.apache.pulsar.common.stats.Metrics>getLoadBalancingMetrics()Generate load balancing stats metrics.voidinitialize(PulsarService pulsar)Initialize this LoadManager.booleanisCentralized()Is centralized decision making to assign a new bundle.voidsetLoadReportForceUpdateFlag()Set flag to force load report update.voidstart()voidstop()voidwriteLoadReportOnZookeeper()Publish the current load report on ZK.default voidwriteLoadReportOnZookeeper(boolean force)Publish the current load report on ZK, forced or not.voidwriteResourceQuotasToZooKeeper()Update namespace bundle resource quota on ZK.
-
-
-
Field Detail
-
LOG
static final org.slf4j.Logger LOG
-
LOADBALANCE_BROKERS_ROOT
static final java.lang.String LOADBALANCE_BROKERS_ROOT
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
java.util.Optional<ResourceUnit> getLeastLoaded(org.apache.pulsar.common.naming.ServiceUnitId su) throws java.lang.Exception
Returns the Least Loaded Resource Unit decided by some algorithm or criteria which is implementation specific.- Throws:
java.lang.Exception
-
generateLoadReport
org.apache.pulsar.policies.data.loadbalancer.LoadManagerReport generateLoadReport() throws java.lang.ExceptionGenerate the load report.- Throws:
java.lang.Exception
-
setLoadReportForceUpdateFlag
void setLoadReportForceUpdateFlag()
Set flag to force load report update.
-
writeLoadReportOnZookeeper
void writeLoadReportOnZookeeper() throws java.lang.ExceptionPublish the current load report on ZK.- Throws:
java.lang.Exception
-
writeLoadReportOnZookeeper
default void writeLoadReportOnZookeeper(boolean force) throws java.lang.ExceptionPublish the current load report on ZK, forced or not. By default rely on method writeLoadReportOnZookeeper().- Throws:
java.lang.Exception
-
writeResourceQuotasToZooKeeper
void writeResourceQuotasToZooKeeper() throws java.lang.ExceptionUpdate namespace bundle resource quota on ZK.- Throws:
java.lang.Exception
-
getLoadBalancingMetrics
java.util.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
void doNamespaceBundleSplit() throws java.lang.ExceptionNamespace bundle split.- Throws:
java.lang.Exception
-
disableBroker
void disableBroker() throws java.lang.ExceptionRemoves 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:
java.lang.Exception
-
getAvailableBrokers
java.util.Set<java.lang.String> getAvailableBrokers() throws java.lang.ExceptionGet list of available brokers in cluster.- Returns:
- Throws:
java.lang.Exception
-
stop
void stop() throws org.apache.pulsar.broker.PulsarServerException
- Throws:
org.apache.pulsar.broker.PulsarServerException
-
initialize
void initialize(PulsarService pulsar)
Initialize this LoadManager.- Parameters:
pulsar- The service to initialize this with.
-
create
static LoadManager create(PulsarService pulsar)
-
-