public interface BalancerStrategy
DataSegments on historical servers (described by ServerHolder). The balancing strategy
is used by LoadRule to assign and drop segments, and by
BalanceSegments to migrate segments between historicals.| Modifier and Type | Method and Description |
|---|---|
void |
emitStats(String tier,
CoordinatorStats stats,
List<ServerHolder> serverHolderList)
Add balancing strategy stats during the 'balanceTier' operation of
BalanceSegments to be included |
ServerHolder |
findNewSegmentHomeBalancer(DataSegment proposalSegment,
List<ServerHolder> serverHolders)
Find the best server to move a
DataSegment to according the balancing strategy. |
ServerHolder |
findNewSegmentHomeReplicator(DataSegment proposalSegment,
List<ServerHolder> serverHolders)
Find the best server on which to place a
DataSegment replica according to the balancing strategy |
default Iterator<BalancerSegmentHolder> |
pickSegmentsToMove(List<ServerHolder> serverHolders,
Set<String> broadcastDatasources,
int reservoirSize,
double percentOfSegmentsToConsider)
Pick the best segments to move from one of the supplied set of servers according to the balancing strategy.
|
default Iterator<ServerHolder> |
pickServersToDrop(DataSegment toDropSegment,
NavigableSet<ServerHolder> serverHolders)
Returns an iterator for a set of servers to drop from, ordered by preference of which server to drop from first
for a given drop strategy.
|
@Nullable ServerHolder findNewSegmentHomeBalancer(DataSegment proposalSegment, List<ServerHolder> serverHolders)
DataSegment to according the balancing strategy.proposalSegment - segment to moveserverHolders - servers to consider as move destinations@Nullable ServerHolder findNewSegmentHomeReplicator(DataSegment proposalSegment, List<ServerHolder> serverHolders)
DataSegment replica according to the balancing strategyproposalSegment - segment to replicateserverHolders - servers to consider as replica holdersdefault Iterator<BalancerSegmentHolder> pickSegmentsToMove(List<ServerHolder> serverHolders, Set<String> broadcastDatasources, int reservoirSize, double percentOfSegmentsToConsider)
serverHolders - set of historicals to consider for moving segmentsbroadcastDatasources - Datasources that contain segments which were loaded via broadcast rules.
Balancing strategies should avoid rebalancing segments for such datasources, since
they should be loaded on all servers anyway.
NOTE: this should really be handled on a per-segment basis, to properly support
the interval or period-based broadcast rules. For simplicity of the initial
implementation, only forever broadcast rules are supported.reservoirSize - the reservoir size maintained by the Reservoir Sampling algorithm.percentOfSegmentsToConsider - The percentage of the total number of segments that we will consider when
choosing which segment to move. CoordinatorDynamicConfig defines a
config percentOfSegmentsToConsiderPerMove that will be used as an argument
for implementations of this method.BalancerSegmentHolder containing segment to move and server they currently
reside on, or empty if there are no segments to pick from (i. e. all provided serverHolders are empty).default Iterator<ServerHolder> pickServersToDrop(DataSegment toDropSegment, NavigableSet<ServerHolder> serverHolders)
toDropSegment - segment to drop from one or more serversserverHolders - set of historicals to consider dropping fromvoid emitStats(String tier, CoordinatorStats stats, List<ServerHolder> serverHolderList)
BalanceSegments to be includedtier - historical tier being balancedstats - stats object to add balancing strategy stats toserverHolderList - servers in tier being balancedCopyright © 2011–2021 The Apache Software Foundation. All rights reserved.