abstract static class StochasticLoadBalancer.CostFunction extends Object
Modifier and Type | Field and Description |
---|---|
protected BaseLoadBalancer.Cluster |
cluster |
private float |
multiplier |
Constructor and Description |
---|
CostFunction(org.apache.hadoop.conf.Configuration c) |
Modifier and Type | Method and Description |
---|---|
(package private) abstract double |
cost() |
protected double |
costFromArray(double[] stats)
Function to compute a scaled cost using
org.apache.commons.math3.stat.descriptive.DescriptiveStatistics . |
(package private) float |
getMultiplier() |
private double |
getSum(double[] stats) |
(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.
|
(package private) boolean |
isNeeded() |
(package private) void |
postAction(BaseLoadBalancer.Cluster.Action action)
Called once per cluster Action to give the cost function
an opportunity to update it's state.
|
protected void |
regionMoved(int region,
int oldServer,
int newServer) |
protected double |
scale(double min,
double max,
double value)
Scale the value between 0 and 1.
|
(package private) void |
setMultiplier(float m) |
private float multiplier
protected BaseLoadBalancer.Cluster cluster
CostFunction(org.apache.hadoop.conf.Configuration c)
boolean isNeeded()
float getMultiplier()
void setMultiplier(float m)
void init(BaseLoadBalancer.Cluster cluster)
void postAction(BaseLoadBalancer.Cluster.Action action)
protected void regionMoved(int region, int oldServer, int newServer)
abstract double cost()
protected double costFromArray(double[] stats)
org.apache.commons.math3.stat.descriptive.DescriptiveStatistics
.
It assumes that this is a zero sum set of costs. It assumes that the worst case
possible is all of the elements in one region server and the rest having 0.stats
- the costsprivate double getSum(double[] stats)
protected double scale(double min, double max, double value)
min
- Min valuemax
- The Max valuevalue
- The value to be scaled.Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.