Class ResourceUnitRanking

  • All Implemented Interfaces:
    java.lang.Comparable<ResourceUnitRanking>

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

      • ResourceUnitRanking

        public ResourceUnitRanking​(SystemResourceUsage systemResourceUsage,
                                   java.util.Set<java.lang.String> loadedBundles,
                                   org.apache.pulsar.common.policies.data.ResourceQuota allocatedQuota,
                                   java.util.Set<java.lang.String> preAllocatedBundles,
                                   org.apache.pulsar.common.policies.data.ResourceQuota preAllocatedQuota)
    • Method Detail

      • setCpuUsageByMsgRate

        public static void setCpuUsageByMsgRate​(double cpuUsageByMsgRate)
      • 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​(java.lang.String suName)
        Check if a ServiceUnit is already loaded by this ResourceUnit.
      • isServiceUnitPreAllocated

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

        public void addPreAllocatedServiceUnit​(java.lang.String suName,
                                               org.apache.pulsar.common.policies.data.ResourceQuota quota)
        Pre-allocate a ServiceUnit to this ResourceUnit.
      • removeLoadedServiceUnit

        public void removeLoadedServiceUnit​(java.lang.String suName,
                                            org.apache.pulsar.common.policies.data.ResourceQuota quota)
        Remove a service unit from the loaded bundle list.
      • getPreAllocatedBundles

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

        public java.util.Set<java.lang.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 java.lang.String 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.