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 Details

    • disableBroker

      void disableBroker() throws PulsarServerException
      As any broker, disable the broker this manager is running on.
      Throws:
      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 PulsarServerException
      As any broker, start the load manager.
      Throws:
      PulsarServerException - If an unexpected error prevented the load manager from being started.
    • stop

      void stop() throws PulsarServerException
      As any broker, stop the load manager.
      Throws:
      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
    • setNamespaceBundleAffinity

      String setNamespaceBundleAffinity(String bundle, String broker)