public class SimpleLoadManagerImpl extends Object implements LoadManager, ZooKeeperCacheListener<org.apache.pulsar.policies.data.loadbalancer.LoadReport>
| Modifier and Type | Field and Description |
|---|---|
static String |
LOADBALANCER_DYNAMIC_SETTING_STRATEGY_ZPATH |
static String |
LOADBALANCER_STRATEGY_LEAST_MSG |
static String |
LOADBALANCER_STRATEGY_LLS |
static String |
LOADBALANCER_STRATEGY_RAND |
static long |
RESOURCE_QUOTA_GO_DOWN_TIMEWINDOW |
static long |
RESOURCE_QUOTA_GO_UP_TIMEWINDOW |
static String |
SETTING_NAME_STRATEGY |
LOADBALANCE_BROKERS_ROOT| Constructor and Description |
|---|
SimpleLoadManagerImpl() |
SimpleLoadManagerImpl(PulsarService pulsar) |
| Modifier and Type | Method and Description |
|---|---|
void |
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.
|
void |
doLoadShedding()
Unload a candidate service unit to balance the load
|
void |
doNamespaceBundleSplit()
Detect and split hot namespace bundles
|
org.apache.pulsar.policies.data.loadbalancer.LoadReport |
generateLoadReport()
Generate the load report
|
ZooKeeperChildrenCache |
getActiveBrokersCache() |
Set<String> |
getAvailableBrokers()
Get list of available brokers in cluster
|
Optional<ResourceUnit> |
getLeastLoaded(org.apache.pulsar.common.naming.ServiceUnitId serviceUnit)
Returns the Least Loaded Resource Unit decided by some algorithm or criteria which is implementation specific
|
List<org.apache.pulsar.common.stats.Metrics> |
getLoadBalancingMetrics()
Generate load balancing stats metrics
|
ZooKeeperDataCache<org.apache.pulsar.policies.data.loadbalancer.LoadReport> |
getLoadReportCache() |
ZooKeeperCache.Deserializer<org.apache.pulsar.policies.data.loadbalancer.LoadReport> |
getLoadReportDeserializer()
Returns
ZooKeeperCache.Deserializer to deserialize load report |
com.google.common.collect.Multimap<Long,ResourceUnit> |
getResourceAvailabilityFor(org.apache.pulsar.common.naming.ServiceUnitId serviceUnitId) |
org.apache.pulsar.policies.data.loadbalancer.SystemResourceUsage |
getSystemResourceUsage() |
void |
initialize(PulsarService pulsar)
Initialize this LoadManager.
|
static boolean |
isAboveLoadLevel(org.apache.pulsar.policies.data.loadbalancer.SystemResourceUsage usage,
float thresholdPercentage) |
static boolean |
isBelowLoadLevel(org.apache.pulsar.policies.data.loadbalancer.SystemResourceUsage usage,
float thresholdPercentage) |
boolean |
isCentralized()
Is centralized decision making to assign a new bundle.
|
void |
onUpdate(String path,
org.apache.pulsar.policies.data.loadbalancer.LoadReport data,
org.apache.zookeeper.data.Stat stat) |
void |
setLoadReportForceUpdateFlag()
Set flag to force load report update
|
void |
start() |
void |
stop() |
void |
writeLoadReportOnZookeeper()
Publish the current load report on ZK
|
void |
writeResourceQuotasToZooKeeper()
Update namespace bundle resource quota on ZK.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreate, writeLoadReportOnZookeeperpublic static final long RESOURCE_QUOTA_GO_UP_TIMEWINDOW
public static final long RESOURCE_QUOTA_GO_DOWN_TIMEWINDOW
public static final String LOADBALANCER_DYNAMIC_SETTING_STRATEGY_ZPATH
public static final String SETTING_NAME_STRATEGY
public static final String LOADBALANCER_STRATEGY_LLS
public static final String LOADBALANCER_STRATEGY_RAND
public static final String LOADBALANCER_STRATEGY_LEAST_MSG
public SimpleLoadManagerImpl()
public SimpleLoadManagerImpl(PulsarService pulsar)
public void initialize(PulsarService pulsar)
LoadManagerinitialize in interface LoadManagerpulsar - The service to initialize this with.public void start()
throws PulsarServerException
start in interface LoadManagerPulsarServerExceptionpublic void disableBroker()
throws Exception
LoadManagerdisableBroker in interface LoadManagerExceptionpublic ZooKeeperCache.Deserializer<org.apache.pulsar.policies.data.loadbalancer.LoadReport> getLoadReportDeserializer()
LoadManagerZooKeeperCache.Deserializer to deserialize load reportgetLoadReportDeserializer in interface LoadManagerpublic ZooKeeperChildrenCache getActiveBrokersCache()
public Set<String> getAvailableBrokers() throws Exception
LoadManagergetAvailableBrokers in interface LoadManagerExceptionpublic ZooKeeperDataCache<org.apache.pulsar.policies.data.loadbalancer.LoadReport> getLoadReportCache()
public boolean isCentralized()
LoadManagerisCentralized in interface LoadManagerpublic void writeResourceQuotasToZooKeeper()
throws Exception
LoadManagerwriteResourceQuotasToZooKeeper in interface LoadManagerExceptionpublic List<org.apache.pulsar.common.stats.Metrics> getLoadBalancingMetrics()
LoadManagergetLoadBalancingMetrics in interface LoadManagerpublic Optional<ResourceUnit> getLeastLoaded(org.apache.pulsar.common.naming.ServiceUnitId serviceUnit) throws Exception
LoadManagergetLeastLoaded in interface LoadManagerExceptionpublic com.google.common.collect.Multimap<Long,ResourceUnit> getResourceAvailabilityFor(org.apache.pulsar.common.naming.ServiceUnitId serviceUnitId) throws Exception
Exceptionpublic void onUpdate(String path, org.apache.pulsar.policies.data.loadbalancer.LoadReport data, org.apache.zookeeper.data.Stat stat)
onUpdate in interface ZooKeeperCacheListener<org.apache.pulsar.policies.data.loadbalancer.LoadReport>public static boolean isAboveLoadLevel(org.apache.pulsar.policies.data.loadbalancer.SystemResourceUsage usage,
float thresholdPercentage)
public static boolean isBelowLoadLevel(org.apache.pulsar.policies.data.loadbalancer.SystemResourceUsage usage,
float thresholdPercentage)
public org.apache.pulsar.policies.data.loadbalancer.SystemResourceUsage getSystemResourceUsage()
throws IOException
IOExceptionpublic org.apache.pulsar.policies.data.loadbalancer.LoadReport generateLoadReport()
throws Exception
LoadManagergenerateLoadReport in interface LoadManagerExceptionpublic void setLoadReportForceUpdateFlag()
LoadManagersetLoadReportForceUpdateFlag in interface LoadManagerpublic void writeLoadReportOnZookeeper()
throws Exception
LoadManagerwriteLoadReportOnZookeeper in interface LoadManagerExceptionpublic void doLoadShedding()
LoadManagerdoLoadShedding in interface LoadManagerpublic void doNamespaceBundleSplit()
throws Exception
doNamespaceBundleSplit in interface LoadManagerExceptionpublic void stop()
throws PulsarServerException
stop in interface LoadManagerPulsarServerExceptionCopyright © 2017–2021 Apache Software Foundation. All rights reserved.