@InterfaceAudience.LimitedPrivate(value="Configuration") public class StochasticLoadBalancer extends BaseLoadBalancer
This is a best effort load balancer. Given a Cost function F(C) => x It will randomly try and mutate the cluster to Cprime. If F(Cprime) < F(C) then the new cluster state becomes the plan. It includes costs functions to compute the cost of:
Every cost function returns a number between 0 and 1 inclusive; where 0 is the lowest cost best solution, and 1 is the highest possible cost and the worst solution. The computed costs are scaled by their respective multipliers:
In addition to the above configurations, the balancer can be tuned by the following configuration values:
This balancer is best used with hbase.master.loadbalance.bytable set to false so that the balancer gets the full picture of all loads on the cluster.
| Modifier and Type | Class and Description |
|---|---|
static class |
StochasticLoadBalancer.CostFromRegionLoadFunction
Base class the allows writing costs functions from rolling average of some
number from RegionLoad.
|
static class |
StochasticLoadBalancer.CostFunction
Base class of StochasticLoadBalancer's Cost Functions.
|
static class |
StochasticLoadBalancer.LoadPicker |
static class |
StochasticLoadBalancer.LocalityCostFunction
Compute a cost of a potential cluster configuration based upon where
StoreFiles are located. |
static class |
StochasticLoadBalancer.MemstoreSizeCostFunction
Compute the cost of total memstore size.
|
static class |
StochasticLoadBalancer.MoveCostFunction
Given the starting state of the regions and a potential ending state
compute cost based upon the number of regions that have moved.
|
static class |
StochasticLoadBalancer.ReadRequestCostFunction
Compute the cost of total number of read requests The more unbalanced the higher the
computed cost will be.
|
static class |
StochasticLoadBalancer.RegionCountSkewCostFunction
Compute the cost of a potential cluster state from skew in number of
regions on a cluster.
|
static class |
StochasticLoadBalancer.StoreFileCostFunction
Compute the cost of total open storefiles size.
|
static class |
StochasticLoadBalancer.TableSkewCostFunction
Compute the cost of a potential cluster configuration based upon how evenly
distributed tables are.
|
static class |
StochasticLoadBalancer.WriteRequestCostFunction
Compute the cost of total number of write requests.
|
BaseLoadBalancer.ClustermetricsBalancer, services, slop| Constructor and Description |
|---|
StochasticLoadBalancer() |
| Modifier and Type | Method and Description |
|---|---|
List<RegionPlan> |
balanceCluster(Map<ServerName,List<HRegionInfo>> clusterState)
Given the cluster state this will try and approach an optimal balance.
|
protected double |
computeCost(BaseLoadBalancer.Cluster cluster,
double previousCost)
This is the main cost function.
|
void |
setClusterStatus(ClusterStatus st)
Set the current cluster status.
|
void |
setConf(org.apache.hadoop.conf.Configuration conf) |
void |
setMasterServices(MasterServices masterServices)
Set the master service.
|
protected void |
setSlop(org.apache.hadoop.conf.Configuration conf) |
getConf, immediateAssignment, initialize, isStopped, needsBalance, randomAssignment, regionOffline, regionOnline, retainAssignment, roundRobinAssignment, stoppublic void setConf(org.apache.hadoop.conf.Configuration conf)
setConf in interface org.apache.hadoop.conf.ConfigurablesetConf in class BaseLoadBalancerprotected void setSlop(org.apache.hadoop.conf.Configuration conf)
setSlop in class BaseLoadBalancerpublic void setClusterStatus(ClusterStatus st)
LoadBalancersetClusterStatus in interface LoadBalancersetClusterStatus in class BaseLoadBalancerpublic void setMasterServices(MasterServices masterServices)
LoadBalancersetMasterServices in interface LoadBalancersetMasterServices in class BaseLoadBalancerpublic List<RegionPlan> balanceCluster(Map<ServerName,List<HRegionInfo>> clusterState)
protected double computeCost(BaseLoadBalancer.Cluster cluster, double previousCost)
cluster - The state of the clusterpreviousCost - the previous cost. This is used as an early out.Copyright © 2014 The Apache Software Foundation. All rights reserved.