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
ConstructorDescriptionResourceUnitRanking
(SystemResourceUsage systemResourceUsage, Set<String> loadedBundles, ResourceQuota allocatedQuota, Set<String> preAllocatedBundles, ResourceQuota preAllocatedQuota) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPreAllocatedServiceUnit
(String suName, ResourceQuota quota) Pre-allocate a ServiceUnit to this ResourceUnit.static long
calculateBrokerMaxCapacity
(SystemResourceUsage systemResourceUsage, ResourceQuota defaultQuota) Estimate the maximum number namespace bundles a ResourceUnit is able to handle with all resource.int
Compare two loads based on message rate only.int
compareTo
(ResourceUnitRanking other) long
estimateMaxCapacity
(ResourceQuota defaultQuota) Estimate the maximum number of namespace bundles ths ResourceUnit is able to handle with all resource.double
Percentage of inbound bandwidth allocated to bundle's quota.double
Percentage of outbound bandwidth allocated to bundle's quota.double
Percentage of CPU allocated to bundle's quota.double
Percetage of memory allocated to bundle's quota.double
Get the estimated load percentage.Get the load percentage in String, with detail resource usages.double
Get the estimated message rate.Get the loaded bundles.Get the pre-allocated bundles.boolean
isIdle()
If the ResourceUnit is idle.boolean
isServiceUnitLoaded
(String suName) Check if a ServiceUnit is already loaded by this ResourceUnit.boolean
isServiceUnitPreAllocated
(String suName) Check if a ServiceUnit is pre-allocated to this ResourceUnit.void
removeLoadedServiceUnit
(String suName, ResourceQuota quota) Remove a service unit from the loaded bundle list.static void
setCpuUsageByMsgRate
(double cpuUsageByMsgRate)
-
Constructor Details
-
ResourceUnitRanking
public ResourceUnitRanking(SystemResourceUsage systemResourceUsage, Set<String> loadedBundles, ResourceQuota allocatedQuota, Set<String> preAllocatedBundles, ResourceQuota preAllocatedQuota)
-
-
Method Details
-
setCpuUsageByMsgRate
public static void setCpuUsageByMsgRate(double cpuUsageByMsgRate) -
compareTo
- Specified by:
compareTo
in 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
Pre-allocate a ServiceUnit to this ResourceUnit. -
removeLoadedServiceUnit
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
Estimate the maximum number of namespace bundles ths ResourceUnit is able to handle with all resource. -
calculateBrokerMaxCapacity
public static long calculateBrokerMaxCapacity(SystemResourceUsage systemResourceUsage, ResourceQuota defaultQuota) Estimate the maximum number namespace bundles a ResourceUnit is able to handle with all resource.
-