Interface ModularLoadManager

All Known Implementing Classes:
ModularLoadManagerImpl

public interface ModularLoadManager
New proposal for a load manager interface which attempts to use more intuitive method names and provide a starting place for new load manager proposals.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    As the leader broker, attempt to automatically detect and split hot namespace bundles.
    void
    As any broker, disable the broker this manager is running on.
    void
    As the leader broker, select bundles for the namespace service to unload so that they may be reassigned to new brokers.
    Get available broker list in cluster.
    Get available broker list in cluster by async invoke.
    org.apache.pulsar.policies.data.loadbalancer.LocalBrokerData
    Fetch local-broker data from load-manager broker cache.
    org.apache.pulsar.policies.data.loadbalancer.BundleData
    Fetch bundle's load report data.
    List<org.apache.pulsar.common.stats.Metrics>
    Fetch load balancing metrics.
    void
    Initialize this load manager using the given pulsar service.
    selectBrokerForAssignment(org.apache.pulsar.common.naming.ServiceUnitId serviceUnit)
    As the leader broker, find a suitable broker for the assignment of the given bundle.
    void
    As any broker, start the load manager.
    void
    As any broker, stop the load manager.
    org.apache.pulsar.policies.data.loadbalancer.LocalBrokerData
    As any broker, retrieve the namespace bundle stats and system resource usage to update data local to this broker.
    void
    As any broker, write the local broker data to ZooKeeper.
    default void
    As any broker, write the local broker data to ZooKeeper, forced or not.
    void
    As the leader broker, write bundle data aggregated from all brokers to ZooKeeper.
  • Method Details

    • disableBroker

      void disableBroker() throws org.apache.pulsar.broker.PulsarServerException
      As any broker, disable the broker this manager is running on.
      Throws:
      org.apache.pulsar.broker.PulsarServerException - If ZooKeeper failed to disable the broker.
    • doLoadShedding

      void doLoadShedding()
      As the leader broker, select bundles for the namespace service to unload so that they may be reassigned to new brokers.
    • checkNamespaceBundleSplit

      void checkNamespaceBundleSplit()
      As the leader broker, attempt to automatically detect and split hot namespace bundles.
    • initialize

      void initialize(PulsarService pulsar)
      Initialize this load manager using the given pulsar service.
    • selectBrokerForAssignment

      Optional<String> selectBrokerForAssignment(org.apache.pulsar.common.naming.ServiceUnitId serviceUnit)
      As the leader broker, find a suitable broker for the assignment of the given bundle.
      Parameters:
      serviceUnit - ServiceUnitId for the bundle.
      Returns:
      The name of the selected broker, as it appears on ZooKeeper.
    • start

      void start() throws org.apache.pulsar.broker.PulsarServerException
      As any broker, start the load manager.
      Throws:
      org.apache.pulsar.broker.PulsarServerException - If an unexpected error prevented the load manager from being started.
    • stop

      void stop() throws org.apache.pulsar.broker.PulsarServerException
      As any broker, stop the load manager.
      Throws:
      org.apache.pulsar.broker.PulsarServerException - If an unexpected error occurred when attempting to stop the load manager.
    • updateLocalBrokerData

      org.apache.pulsar.policies.data.loadbalancer.LocalBrokerData updateLocalBrokerData()
      As any broker, retrieve the namespace bundle stats and system resource usage to update data local to this broker.
    • writeBrokerDataOnZooKeeper

      void writeBrokerDataOnZooKeeper()
      As any broker, write the local broker data to ZooKeeper.
    • writeBrokerDataOnZooKeeper

      default void writeBrokerDataOnZooKeeper(boolean force)
      As any broker, write the local broker data to ZooKeeper, forced or not.
    • writeBundleDataOnZooKeeper

      void writeBundleDataOnZooKeeper()
      As the leader broker, write bundle data aggregated from all brokers to ZooKeeper.
    • getAvailableBrokers

      Set<String> getAvailableBrokers()
      Get available broker list in cluster.
      Returns:
    • getAvailableBrokersAsync

      CompletableFuture<Set<String>> getAvailableBrokersAsync()
      Get available broker list in cluster by async invoke.
    • getBrokerLocalData

      org.apache.pulsar.policies.data.loadbalancer.LocalBrokerData getBrokerLocalData(String broker)
      Fetch local-broker data from load-manager broker cache.
      Parameters:
      broker - load-balancer path
      Returns:
    • getLoadBalancingMetrics

      List<org.apache.pulsar.common.stats.Metrics> getLoadBalancingMetrics()
      Fetch load balancing metrics.
      Returns:
      List of LoadBalancing Metrics
    • getBundleDataOrDefault

      org.apache.pulsar.policies.data.loadbalancer.BundleData getBundleDataOrDefault(String bundle)
      Fetch bundle's load report data.
      Parameters:
      bundle -
      Returns:
      bundle data