Class CacheAwareLoadBalancer
java.lang.Object
org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer
org.apache.hadoop.hbase.master.balancer.StochasticLoadBalancer
org.apache.hadoop.hbase.master.balancer.CacheAwareLoadBalancer
- All Implemented Interfaces:
ConfigurationObserver,LoadBalancer,Stoppable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class(package private) class(package private) static classprivate class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final floatprivate org.apache.hadoop.conf.Configurationprivate static final org.slf4j.Loggerstatic final floatstatic final StringBelow this cache ratio on the current host, a move may be considered for the free-space heuristic.private floatstatic final floatstatic final StringMinimum free block cache on a target server, as a multiple of the region's on-disk size in bytes, required to count that server as a relocation opportunity.private floatstatic final floatstatic final StringOptimistic region cache ratio assumed for cost purposes when a better host has free cache space (actual warmup is not modeled).private floatprivate BigDecimalprivate LongFields inherited from class org.apache.hadoop.hbase.master.balancer.StochasticLoadBalancer
candidateGenerators, COST_FUNCTIONS_COST_FUNCTIONS_KEY, costFunctions, DEFAULT_KEEP_REGION_LOADS, DEFAULT_MAX_RUNNING_TIME, DEFAULT_MAX_STEPS, DEFAULT_MIN_COST_NEED_BALANCE, DEFAULT_RUN_MAX_STEPS, DEFAULT_STEPS_PER_REGION, KEEP_REGION_LOADS, loads, MAX_RUNNING_TIME_KEY, MAX_STEPS_KEY, MIN_COST_NEED_BALANCE_KEY, OVERALL_COST_FUNCTION_NAME, regionCacheRatioOnOldServerMap, RUN_MAX_STEPS_KEY, shuffledGeneratorClasses, STEPS_PER_REGION_KEYFields inherited from class org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer
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, REGIONS_SLOP_DEFAULT, REGIONS_SLOP_KEY, slop, useRegionFinderFields inherited from interface org.apache.hadoop.hbase.master.LoadBalancer
BOGUS_SERVER_NAME, HBASE_RSGROUP_LOADBALANCER_CLASS, MOVE_THROTTLING, MOVE_THROTTLING_DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddCostFunction(List<CostFunction> costFunctions, CostFunction costFunction) protected List<RegionPlan>balanceTable(TableName tableName, Map<ServerName, List<RegionInfo>> loadOfOneTable) Given the cluster state this will try and approach an optimal balance.protected Map<Class<? extends CandidateGenerator>,CandidateGenerator> createCandidateGenerators(org.apache.hadoop.conf.Configuration conf) protected List<CostFunction>createCostFunctions(org.apache.hadoop.conf.Configuration configuration) protected BalancerClusterStatecreateState(Map<ServerName, List<RegionInfo>> clusterState, Map<String, Deque<BalancerRegionLoad>> loads, RegionHDFSBlockLocationFinder finder, RackManager rackManager) private RegionInfogetRegionInfoByEncodedName(BalancerClusterState cluster, String regionName) protected Map<ServerName,Long> longvoidloadConf(org.apache.hadoop.conf.Configuration configuration) voidupdateClusterMetrics(ClusterMetrics clusterMetrics) Set the current cluster status.private voidCollect the amount of region cached for all the regions from all the active region servers.Methods inherited from class org.apache.hadoop.hbase.master.balancer.StochasticLoadBalancer
composeAttributeName, computeCost, functionCost, getCandidateGenerators, getCostFunctionNames, getCostFunctions, getRandomGenerator, initCosts, needsBalance, nextAction, sendRejectionReasonToRingBuffer, setRackManager, updateBalancerLoadInfo, updateCostsAndWeightsWithAction, updateMetricsSizeMethods inherited from class org.apache.hadoop.hbase.master.balancer.BaseLoadBalancer
balanceCluster, getConf, getDefaultSlop, idleRegionServerExist, initialize, isStopped, onConfigurationChange, postMasterStartupInitialize, preBalanceCluster, randomAssignment, regionOffline, regionOnline, retainAssignment, roundRobinAssignment, setClusterInfoProvider, sloppyRegionServerExist, stop, toEnsumbleTableLoad, updateBalancerStatusMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.hbase.master.LoadBalancer
onBalancingComplete, onBalancingStart, throttle
-
Field Details
-
LOG
-
CACHE_RATIO_THRESHOLD
- See Also:
-
CACHE_RATIO_THRESHOLD_DEFAULT
- See Also:
-
LOW_CACHE_RATIO_FOR_RELOCATION_KEY
Below this cache ratio on the current host, a move may be considered for the free-space heuristic.- See Also:
-
LOW_CACHE_RATIO_FOR_RELOCATION_DEFAULT
- See Also:
-
POTENTIAL_CACHE_RATIO_AFTER_MOVE_KEY
Optimistic region cache ratio assumed for cost purposes when a better host has free cache space (actual warmup is not modeled).- See Also:
-
POTENTIAL_CACHE_RATIO_AFTER_MOVE_DEFAULT
- See Also:
-
MIN_FREE_CACHE_SPACE_FACTOR_KEY
Minimum free block cache on a target server, as a multiple of the region's on-disk size in bytes, required to count that server as a relocation opportunity.- See Also:
-
MIN_FREE_CACHE_SPACE_FACTOR_DEFAULT
- See Also:
-
ratioThreshold
-
sleepTime
-
configuration
-
lowCacheRatioThreshold
-
potentialCacheRatioAfterMove
-
minFreeCacheSpaceFactor
-
simulatedRatio
-
-
Constructor Details
-
CacheAwareLoadBalancer
public CacheAwareLoadBalancer()
-
-
Method Details
-
loadConf
- Overrides:
loadConfin classStochasticLoadBalancer
-
createCandidateGenerators
protected Map<Class<? extends CandidateGenerator>,CandidateGenerator> createCandidateGenerators(org.apache.hadoop.conf.Configuration conf) - Overrides:
createCandidateGeneratorsin classStochasticLoadBalancer
-
createCostFunctions
protected List<CostFunction> createCostFunctions(org.apache.hadoop.conf.Configuration configuration) - Overrides:
createCostFunctionsin classStochasticLoadBalancer
-
addCostFunction
-
updateClusterMetrics
Description copied from interface:LoadBalancerSet the current cluster status. This allows a LoadBalancer to map host name to a server- Specified by:
updateClusterMetricsin interfaceLoadBalancer- Overrides:
updateClusterMetricsin classStochasticLoadBalancer
-
getServerBlockCacheFreeBytes
-
createState
protected BalancerClusterState createState(Map<ServerName, List<RegionInfo>> clusterState, Map<String, Deque<BalancerRegionLoad>> loads, RegionHDFSBlockLocationFinder finder, RackManager rackManager) - Overrides:
createStatein classStochasticLoadBalancer
-
updateRegionLoad
Collect the amount of region cached for all the regions from all the active region servers. -
getRegionInfoByEncodedName
-
getThrottleDurationMs
-
balanceTable
protected List<RegionPlan> balanceTable(TableName tableName, Map<ServerName, List<RegionInfo>> loadOfOneTable) Description copied from class:StochasticLoadBalancerGiven the cluster state this will try and approach an optimal balance. This should always approach the optimal state given enough steps.- Overrides:
balanceTablein classStochasticLoadBalancer- Parameters:
tableName- the table to be balancedloadOfOneTable- region load of servers for the specific one table- Returns:
- List of plans
-