public class CostBalancerStrategy extends Object implements BalancerStrategy
Constructor and Description |
---|
CostBalancerStrategy(org.joda.time.DateTime referenceTimestamp,
int threadCount) |
Modifier and Type | Method and Description |
---|---|
double |
calculateInitialTotalCost(List<ServerHolder> serverHolders)
Calculates the initial cost of the Druid segment configuration.
|
double |
calculateNormalization(List<ServerHolder> serverHolders)
Calculates the cost normalization.
|
protected com.metamx.common.Pair<Double,ServerHolder> |
chooseBestServer(io.druid.timeline.DataSegment proposalSegment,
Iterable<ServerHolder> serverHolders,
boolean includeCurrentServer)
For assignment, we want to move to the lowest cost server that isn't already serving the segment.
|
protected double |
computeCost(io.druid.timeline.DataSegment proposalSegment,
ServerHolder server,
boolean includeCurrentServer) |
double |
computeJointSegmentCosts(io.druid.timeline.DataSegment segment1,
io.druid.timeline.DataSegment segment2)
This defines the unnormalized cost function between two segments.
|
void |
emitStats(String tier,
CoordinatorStats stats,
List<ServerHolder> serverHolderList) |
ServerHolder |
findNewSegmentHomeBalancer(io.druid.timeline.DataSegment proposalSegment,
List<ServerHolder> serverHolders) |
ServerHolder |
findNewSegmentHomeReplicator(io.druid.timeline.DataSegment proposalSegment,
List<ServerHolder> serverHolders) |
BalancerSegmentHolder |
pickSegmentToMove(List<ServerHolder> serverHolders) |
public CostBalancerStrategy(org.joda.time.DateTime referenceTimestamp, int threadCount)
public ServerHolder findNewSegmentHomeReplicator(io.druid.timeline.DataSegment proposalSegment, List<ServerHolder> serverHolders)
findNewSegmentHomeReplicator
in interface BalancerStrategy
public ServerHolder findNewSegmentHomeBalancer(io.druid.timeline.DataSegment proposalSegment, List<ServerHolder> serverHolders)
findNewSegmentHomeBalancer
in interface BalancerStrategy
public double computeJointSegmentCosts(io.druid.timeline.DataSegment segment1, io.druid.timeline.DataSegment segment2)
segment1
- The first DataSegment.segment2
- The second DataSegment.public BalancerSegmentHolder pickSegmentToMove(List<ServerHolder> serverHolders)
pickSegmentToMove
in interface BalancerStrategy
public double calculateInitialTotalCost(List<ServerHolder> serverHolders)
serverHolders
- A list of ServerHolders for a particular tier.public double calculateNormalization(List<ServerHolder> serverHolders)
serverHolders
- A list of ServerHolders for a particular tier.public void emitStats(String tier, CoordinatorStats stats, List<ServerHolder> serverHolderList)
emitStats
in interface BalancerStrategy
protected double computeCost(io.druid.timeline.DataSegment proposalSegment, ServerHolder server, boolean includeCurrentServer)
protected com.metamx.common.Pair<Double,ServerHolder> chooseBestServer(io.druid.timeline.DataSegment proposalSegment, Iterable<ServerHolder> serverHolders, boolean includeCurrentServer)
proposalSegment
- A DataSegment that we are proposing to move.serverHolders
- An iterable of ServerHolders for a particular tier.Copyright © 2011–2015. All rights reserved.