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

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void checkNamespaceBundleSplit()
      As the leader broker, attempt to automatically detect and split hot namespace bundles.
      void disableBroker()
      As any broker, disable the broker this manager is running on.
      void doLoadShedding()
      As the leader broker, select bundles for the namespace service to unload so that they may be reassigned to new brokers.
      java.util.Set<java.lang.String> getAvailableBrokers()
      Get available broker list in cluster.
      org.apache.pulsar.policies.data.loadbalancer.LocalBrokerData getBrokerLocalData​(java.lang.String broker)
      Fetch local-broker data from load-manager broker cache.
      java.util.List<org.apache.pulsar.common.stats.Metrics> getLoadBalancingMetrics()
      Fetch load balancing metrics.
      void initialize​(PulsarService pulsar)
      Initialize this load manager using the given pulsar service.
      java.util.Optional<java.lang.String> selectBrokerForAssignment​(org.apache.pulsar.common.naming.ServiceUnitId serviceUnit)
      As the leader broker, find a suitable broker for the assignment of the given bundle.
      void start()
      As any broker, start the load manager.
      void stop()
      As any broker, stop the load manager.
      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.
      void writeBrokerDataOnZooKeeper()
      As any broker, write the local broker data to ZooKeeper.
      default void writeBrokerDataOnZooKeeper​(boolean force)
      As any broker, write the local broker data to ZooKeeper, forced or not.
      void writeBundleDataOnZooKeeper()
      As the leader broker, write bundle data aggregated from all brokers to ZooKeeper.
    • Method Detail

      • 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

        java.util.Optional<java.lang.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

        java.util.Set<java.lang.String> getAvailableBrokers()
        Get available broker list in cluster.
        Returns:
      • getBrokerLocalData

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

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