static class StochasticLoadBalancer.RegionReplicaHostCostFunction extends StochasticLoadBalancer.CostFunction
Modifier and Type | Field and Description |
---|---|
(package private) long[] |
costsPerGroup |
private static float |
DEFAULT_REGION_REPLICA_HOST_COST_KEY |
(package private) long |
maxCost |
(package private) int[][] |
primariesOfRegionsPerGroup |
private static String |
REGION_REPLICA_HOST_COST_KEY |
cluster
Constructor and Description |
---|
StochasticLoadBalancer.RegionReplicaHostCostFunction(org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
(package private) double |
cost() |
protected long |
costPerGroup(int[] primariesOfRegions)
For each primary region, it computes the total number of replicas in the array (numReplicas)
and returns a sum of numReplicas-1 squared.
|
(package private) long |
getMaxCost(BaseLoadBalancer.Cluster cluster) |
(package private) void |
init(BaseLoadBalancer.Cluster cluster)
Called once per LB invocation to give the cost function
to initialize it's state, and perform any costly calculation.
|
protected void |
regionMoved(int region,
int oldServer,
int newServer) |
costFromArray, getMultiplier, postAction, scale, setMultiplier
private static final String REGION_REPLICA_HOST_COST_KEY
private static final float DEFAULT_REGION_REPLICA_HOST_COST_KEY
long maxCost
long[] costsPerGroup
int[][] primariesOfRegionsPerGroup
public StochasticLoadBalancer.RegionReplicaHostCostFunction(org.apache.hadoop.conf.Configuration conf)
void init(BaseLoadBalancer.Cluster cluster)
StochasticLoadBalancer.CostFunction
init
in class StochasticLoadBalancer.CostFunction
long getMaxCost(BaseLoadBalancer.Cluster cluster)
double cost()
cost
in class StochasticLoadBalancer.CostFunction
protected long costPerGroup(int[] primariesOfRegions)
primariesOfRegions
- a sorted array of primary regions ids for the regions hostedprotected void regionMoved(int region, int oldServer, int newServer)
regionMoved
in class StochasticLoadBalancer.CostFunction
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.