Class ResourceUnitRanking
java.lang.Object
org.apache.pulsar.policies.data.loadbalancer.ResourceUnitRanking
- All Implemented Interfaces:
Comparable<ResourceUnitRanking>
The class containing information about system resources, allocated quota, and loaded bundles.
-
Constructor Summary
ConstructorsConstructorDescriptionResourceUnitRanking(SystemResourceUsage systemResourceUsage, Set<String> loadedBundles, org.apache.pulsar.common.policies.data.ResourceQuota allocatedQuota, Set<String> preAllocatedBundles, org.apache.pulsar.common.policies.data.ResourceQuota preAllocatedQuota) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPreAllocatedServiceUnit(String suName, org.apache.pulsar.common.policies.data.ResourceQuota quota) Pre-allocate a ServiceUnit to this ResourceUnit.static longcalculateBrokerMaxCapacity(SystemResourceUsage systemResourceUsage, org.apache.pulsar.common.policies.data.ResourceQuota defaultQuota) Estimate the maximum number namespace bundles a ResourceUnit is able to handle with all resource.intCompare two loads based on message rate only.intcompareTo(ResourceUnitRanking other) longestimateMaxCapacity(org.apache.pulsar.common.policies.data.ResourceQuota defaultQuota) Estimate the maximum number of namespace bundles ths ResourceUnit is able to handle with all resource.doublePercentage of inbound bandwidth allocated to bundle's quota.doublePercentage of outbound bandwidth allocated to bundle's quota.doublePercentage of CPU allocated to bundle's quota.doublePercetage of memory allocated to bundle's quota.doubleGet the estimated load percentage.Get the load percentage in String, with detail resource usages.doubleGet the estimated message rate.Get the loaded bundles.Get the pre-allocated bundles.booleanisIdle()If the ResourceUnit is idle.booleanisServiceUnitLoaded(String suName) Check if a ServiceUnit is already loaded by this ResourceUnit.booleanisServiceUnitPreAllocated(String suName) Check if a ServiceUnit is pre-allocated to this ResourceUnit.voidremoveLoadedServiceUnit(String suName, org.apache.pulsar.common.policies.data.ResourceQuota quota) Remove a service unit from the loaded bundle list.static voidsetCpuUsageByMsgRate(double cpuUsageByMsgRate)
-
Constructor Details
-
ResourceUnitRanking
public ResourceUnitRanking(SystemResourceUsage systemResourceUsage, Set<String> loadedBundles, org.apache.pulsar.common.policies.data.ResourceQuota allocatedQuota, Set<String> preAllocatedBundles, org.apache.pulsar.common.policies.data.ResourceQuota preAllocatedQuota)
-
-
Method Details
-
setCpuUsageByMsgRate
public static void setCpuUsageByMsgRate(double cpuUsageByMsgRate) -
compareTo
- Specified by:
compareToin interfaceComparable<ResourceUnitRanking>
-
compareMessageRateTo
Compare two loads based on message rate only. -
isIdle
public boolean isIdle()If the ResourceUnit is idle. -
isServiceUnitLoaded
Check if a ServiceUnit is already loaded by this ResourceUnit. -
isServiceUnitPreAllocated
Check if a ServiceUnit is pre-allocated to this ResourceUnit. -
addPreAllocatedServiceUnit
public void addPreAllocatedServiceUnit(String suName, org.apache.pulsar.common.policies.data.ResourceQuota quota) Pre-allocate a ServiceUnit to this ResourceUnit. -
removeLoadedServiceUnit
public void removeLoadedServiceUnit(String suName, org.apache.pulsar.common.policies.data.ResourceQuota quota) Remove a service unit from the loaded bundle list. -
getPreAllocatedBundles
Get the pre-allocated bundles. -
getLoadedBundles
Get the loaded bundles. -
getEstimatedLoadPercentage
public double getEstimatedLoadPercentage()Get the estimated load percentage. -
getEstimatedMessageRate
public double getEstimatedMessageRate()Get the estimated message rate. -
getAllocatedLoadPercentageCPU
public double getAllocatedLoadPercentageCPU()Percentage of CPU allocated to bundle's quota. -
getAllocatedLoadPercentageMemory
public double getAllocatedLoadPercentageMemory()Percetage of memory allocated to bundle's quota. -
getAllocatedLoadPercentageBandwidthIn
public double getAllocatedLoadPercentageBandwidthIn()Percentage of inbound bandwidth allocated to bundle's quota. -
getAllocatedLoadPercentageBandwidthOut
public double getAllocatedLoadPercentageBandwidthOut()Percentage of outbound bandwidth allocated to bundle's quota. -
getEstimatedLoadPercentageString
Get the load percentage in String, with detail resource usages. -
estimateMaxCapacity
public long estimateMaxCapacity(org.apache.pulsar.common.policies.data.ResourceQuota defaultQuota) Estimate the maximum number of namespace bundles ths ResourceUnit is able to handle with all resource. -
calculateBrokerMaxCapacity
public static long calculateBrokerMaxCapacity(SystemResourceUsage systemResourceUsage, org.apache.pulsar.common.policies.data.ResourceQuota defaultQuota) Estimate the maximum number namespace bundles a ResourceUnit is able to handle with all resource.
-