Interface BalancerStrategy

All Known Implementing Classes:
CachingCostBalancerStrategy, CostBalancerStrategy, DiskNormalizedCostBalancerStrategy, RandomBalancerStrategy

public interface BalancerStrategy
Segment balancing strategy, used in every coordinator run by StrategicSegmentAssigner to choose optimal servers to load, move or drop a segment.
  • Method Details

    • findDestinationServerToMoveSegment

      @Nullable ServerHolder findDestinationServerToMoveSegment(DataSegment segmentToMove, ServerHolder sourceServer, List<ServerHolder> destinationServers)
      Finds the best server from the list of destinationServers to load the segmentToMove, if it is moved from the sourceServer.

      In order to avoid unnecessary moves when the segment is already optimally placed, include the sourceServer in the list of destinationServers.

      Returns:
      The server to move to, or null if the segment is already optimally placed.
    • findServersToLoadSegment

      Iterator<ServerHolder> findServersToLoadSegment(DataSegment segmentToLoad, List<ServerHolder> serverHolders)
      Finds the best servers to load the given segment. This method can be used both for placing the first copy of a segment in a tier or a replica of an already available segment.
      Returns:
      Iterator over the best servers (in order of preference) to load the segment.
    • findServersToDropSegment

      Iterator<ServerHolder> findServersToDropSegment(DataSegment segmentToDrop, List<ServerHolder> serverHolders)
      Finds the best servers to drop the given segment.
      Returns:
      Iterator over the servers (in order of preference) to drop the segment
    • getStats

      Returns the stats collected by the strategy.