Interface LoadManager

All Known Implementing Classes:
ModularLoadManagerWrapper, NoopLoadManager, SimpleLoadManagerImpl

public interface LoadManager
LoadManager runs through set of load reports collected from different brokers and generates a recommendation of namespace/ServiceUnit placement on machines/ResourceUnit. Each Concrete Load Manager will use different algorithms to generate this mapping. Concrete Load Manager is also return the least loaded broker that should own the new namespace.
  • Field Details

    • LOG

      static final org.slf4j.Logger LOG
    • LOADBALANCE_BROKERS_ROOT

      static final String LOADBALANCE_BROKERS_ROOT
      See Also:
  • Method Details

    • start

      void start() throws org.apache.pulsar.broker.PulsarServerException
      Throws:
      org.apache.pulsar.broker.PulsarServerException
    • isCentralized

      boolean isCentralized()
      Is centralized decision making to assign a new bundle.
    • getLeastLoaded

      Optional<ResourceUnit> getLeastLoaded(org.apache.pulsar.common.naming.ServiceUnitId su) throws Exception
      Returns the Least Loaded Resource Unit decided by some algorithm or criteria which is implementation specific.
      Throws:
      Exception
    • generateLoadReport

      org.apache.pulsar.policies.data.loadbalancer.LoadManagerReport generateLoadReport() throws Exception
      Generate the load report.
      Throws:
      Exception
    • setLoadReportForceUpdateFlag

      void setLoadReportForceUpdateFlag()
      Set flag to force load report update.
    • writeLoadReportOnZookeeper

      void writeLoadReportOnZookeeper() throws Exception
      Publish the current load report on ZK.
      Throws:
      Exception
    • writeLoadReportOnZookeeper

      default void writeLoadReportOnZookeeper(boolean force) throws Exception
      Publish the current load report on ZK, forced or not. By default rely on method writeLoadReportOnZookeeper().
      Throws:
      Exception
    • writeResourceQuotasToZooKeeper

      void writeResourceQuotasToZooKeeper() throws Exception
      Update namespace bundle resource quota on ZK.
      Throws:
      Exception
    • getLoadBalancingMetrics

      List<org.apache.pulsar.common.stats.Metrics> getLoadBalancingMetrics()
      Generate load balancing stats metrics.
    • doLoadShedding

      void doLoadShedding()
      Unload a candidate service unit to balance the load.
    • doNamespaceBundleSplit

      void doNamespaceBundleSplit() throws Exception
      Namespace bundle split.
      Throws:
      Exception
    • disableBroker

      void disableBroker() throws Exception
      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.
      Throws:
      Exception
    • getAvailableBrokers

      Set<String> getAvailableBrokers() throws Exception
      Get list of available brokers in cluster.
      Returns:
      Throws:
      Exception
    • getAvailableBrokersAsync

      CompletableFuture<Set<String>> getAvailableBrokersAsync()
    • stop

      void stop() throws org.apache.pulsar.broker.PulsarServerException
      Throws:
      org.apache.pulsar.broker.PulsarServerException
    • initialize

      void initialize(PulsarService pulsar)
      Initialize this LoadManager.
      Parameters:
      pulsar - The service to initialize this with.
    • create

      static LoadManager create(PulsarService pulsar)