static class CacheAwareLoadBalancer.CacheAwareCostFunction extends CostFunction
Modifier and Type | Field and Description |
---|---|
private double |
bestCacheRatio |
private static String |
CACHE_COST_KEY |
private double |
cacheRatio |
private static float |
DEFAULT_CACHE_COST |
cluster, COST_EPSILON
Constructor and Description |
---|
CacheAwareCostFunction(org.apache.hadoop.conf.Configuration conf) |
Modifier and Type | Method and Description |
---|---|
protected double |
cost() |
private int |
getServerWithBestCacheRatioForRegion(int region) |
(package private) void |
prepare(BalancerClusterState 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) |
void |
updateWeight(double[] weights)
Add the cost of this cost function to the weight of the candidate generator that is optimized
for this cost function.
|
getMultiplier, isNeeded, postAction, scale, setMultiplier
private static final String CACHE_COST_KEY
private double cacheRatio
private double bestCacheRatio
private static final float DEFAULT_CACHE_COST
CacheAwareCostFunction(org.apache.hadoop.conf.Configuration conf)
void prepare(BalancerClusterState cluster)
CostFunction
prepare
in class CostFunction
protected double cost()
cost
in class CostFunction
protected void regionMoved(int region, int oldServer, int newServer)
regionMoved
in class CostFunction
private int getServerWithBestCacheRatioForRegion(int region)
public final void updateWeight(double[] weights)
CostFunction
updateWeight
in class CostFunction
weights
- the weights for every generator.Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.