@InterfaceAudience.LimitedPrivate(value="Configuration") public class SimpleLoadBalancer extends BaseLoadBalancer
BaseLoadBalancer.balanceCluster(Map)
.
On cluster startup, bulk assignment can be used to determine locations for all Regions in a
cluster.
This classes produces plans for the AssignmentManager
to execute.Modifier and Type | Class and Description |
---|---|
private static class |
SimpleLoadBalancer.BalanceInfo
Stores additional per-server information about the regions added/removed during the run of the
balancing algorithm.
|
Modifier and Type | Field and Description |
---|---|
private float |
avgLoadOverall |
private static org.slf4j.Logger |
LOG |
private float |
overallSlop |
private RegionInfoComparator |
riComparator |
private RegionPlan.RegionPlanComparator |
rpComparator |
private List<ServerAndLoad> |
serverLoadList |
BALANCER_DECISION_BUFFER_ENABLED, BALANCER_REJECTION_BUFFER_ENABLED, clusterStatus, DEFAULT_BALANCER_DECISION_BUFFER_ENABLED, DEFAULT_BALANCER_REJECTION_BUFFER_ENABLED, DEFAULT_HBASE_MASTER_LOADBALANCE_BYTABLE, isByTable, masterServerName, metricsBalancer, MIN_SERVER_BALANCE, provider, rackManager, regionFinder, slop, useRegionFinder
BOGUS_SERVER_NAME, HBASE_RSGROUP_LOADBALANCER_CLASS
Constructor and Description |
---|
SimpleLoadBalancer() |
Modifier and Type | Method and Description |
---|---|
private void |
addRegionPlan(org.apache.hbase.thirdparty.com.google.common.collect.MinMaxPriorityQueue<RegionPlan> regionsToMove,
boolean fetchFromTail,
ServerName sn,
List<RegionPlan> regionsToReturn)
Add a region from the head or tail to the List of regions to return.
|
private void |
balanceOverall(List<RegionPlan> regionsToReturn,
Map<ServerName,SimpleLoadBalancer.BalanceInfo> serverBalanceInfo,
boolean fetchFromTail,
org.apache.hbase.thirdparty.com.google.common.collect.MinMaxPriorityQueue<RegionPlan> regionsToMove,
int max,
int min)
If we need to balanceoverall, we need to add one more round to peel off one region from each
max.
|
protected List<RegionPlan> |
balanceTable(TableName tableName,
Map<ServerName,List<RegionInfo>> loadOfOneTable)
Generate a global load balancing plan according to the specified map of server information to
the most loaded regions of each server.
|
protected void |
loadConf(org.apache.hadoop.conf.Configuration conf) |
private boolean |
needsBalance(BalancerClusterState c) |
void |
onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
Notification that config has changed
|
private boolean |
overallNeedsBalance()
A checker function to decide when we want balance overall and certain table has been balanced,
do we still need to re-distribute regions of this table to achieve the state of overall-balance
|
protected void |
preBalanceCluster(Map<TableName,Map<ServerName,List<RegionInfo>>> loadOfAllTable)
Called before actually executing balanceCluster.
|
(package private) void |
setClusterLoad(Map<TableName,Map<ServerName,List<RegionInfo>>> clusterLoad)
Pass RegionStates and allow balancer to set the current cluster load.
|
private void |
setLoad(List<ServerAndLoad> slList,
int i,
int loadChange) |
balanceCluster, getConf, getDefaultSlop, idleRegionServerExist, initialize, isStopped, postMasterStartupInitialize, randomAssignment, regionOffline, regionOnline, retainAssignment, roundRobinAssignment, setClusterInfoProvider, sloppyRegionServerExist, stop, toEnsumbleTableLoad, updateBalancerStatus, updateClusterMetrics
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
updateBalancerLoadInfo
private static final org.slf4j.Logger LOG
private RegionInfoComparator riComparator
private RegionPlan.RegionPlanComparator rpComparator
private float avgLoadOverall
private List<ServerAndLoad> serverLoadList
private float overallSlop
public SimpleLoadBalancer()
void setClusterLoad(Map<TableName,Map<ServerName,List<RegionInfo>>> clusterLoad)
protected void preBalanceCluster(Map<TableName,Map<ServerName,List<RegionInfo>>> loadOfAllTable)
BaseLoadBalancer
preBalanceCluster
in class BaseLoadBalancer
protected void loadConf(org.apache.hadoop.conf.Configuration conf)
loadConf
in class BaseLoadBalancer
public void onConfigurationChange(org.apache.hadoop.conf.Configuration conf)
LoadBalancer
onConfigurationChange
in interface ConfigurationObserver
onConfigurationChange
in interface LoadBalancer
onConfigurationChange
in class BaseLoadBalancer
private void setLoad(List<ServerAndLoad> slList, int i, int loadChange)
private boolean overallNeedsBalance()
private boolean needsBalance(BalancerClusterState c)
protected List<RegionPlan> balanceTable(TableName tableName, Map<ServerName,List<RegionInfo>> loadOfOneTable)
Order the regions to move from most recent to least.
balanceTable
in class BaseLoadBalancer
loadOfOneTable
- Map of regionservers and their load/region information to a list of their
most loaded regionstableName
- the table to be balancedprivate void balanceOverall(List<RegionPlan> regionsToReturn, Map<ServerName,SimpleLoadBalancer.BalanceInfo> serverBalanceInfo, boolean fetchFromTail, org.apache.hbase.thirdparty.com.google.common.collect.MinMaxPriorityQueue<RegionPlan> regionsToMove, int max, int min)
private void addRegionPlan(org.apache.hbase.thirdparty.com.google.common.collect.MinMaxPriorityQueue<RegionPlan> regionsToMove, boolean fetchFromTail, ServerName sn, List<RegionPlan> regionsToReturn)
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.