Class ResourceUnitRanking

java.lang.Object
org.apache.pulsar.policies.data.loadbalancer.ResourceUnitRanking
All Implemented Interfaces:
Comparable<ResourceUnitRanking>

public class ResourceUnitRanking extends Object implements Comparable<ResourceUnitRanking>
The class containing information about system resources, allocated quota, and loaded bundles.
  • Constructor Details

  • Method Details

    • setCpuUsageByMsgRate

      public static void setCpuUsageByMsgRate(double cpuUsageByMsgRate)
    • compareTo

      public int compareTo(ResourceUnitRanking other)
      Specified by:
      compareTo in interface Comparable<ResourceUnitRanking>
    • compareMessageRateTo

      public int compareMessageRateTo(ResourceUnitRanking other)
      Compare two loads based on message rate only.
    • isIdle

      public boolean isIdle()
      If the ResourceUnit is idle.
    • isServiceUnitLoaded

      public boolean isServiceUnitLoaded(String suName)
      Check if a ServiceUnit is already loaded by this ResourceUnit.
    • isServiceUnitPreAllocated

      public boolean isServiceUnitPreAllocated(String suName)
      Check if a ServiceUnit is pre-allocated to this ResourceUnit.
    • addPreAllocatedServiceUnit

      public void addPreAllocatedServiceUnit(String suName, ResourceQuota quota)
      Pre-allocate a ServiceUnit to this ResourceUnit.
    • removeLoadedServiceUnit

      public void removeLoadedServiceUnit(String suName, ResourceQuota quota)
      Remove a service unit from the loaded bundle list.
    • getPreAllocatedBundles

      public Set<String> getPreAllocatedBundles()
      Get the pre-allocated bundles.
    • getLoadedBundles

      public Set<String> 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

      public String getEstimatedLoadPercentageString()
      Get the load percentage in String, with detail resource usages.
    • estimateMaxCapacity

      public long estimateMaxCapacity(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, ResourceQuota defaultQuota)
      Estimate the maximum number namespace bundles a ResourceUnit is able to handle with all resource.