|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.hbase.master.LoadBalancer
public class LoadBalancer
Makes decisions about the placement and movement of Regions across RegionServers.
Cluster-wide load balancing will occur only when there are no regions in
transition and according to a fixed period of a time using balanceCluster(Map)
.
Inline region placement with immediateAssignment(java.util.List
can be used when
the Master needs to handle closed regions that it currently does not have
a destination set for. This can happen during master failover.
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.
Nested Class Summary | |
---|---|
static class |
LoadBalancer.RegionPlan
Stores the plan for the move of an individual region. |
Method Summary | |
---|---|
List<LoadBalancer.RegionPlan> |
balanceCluster(Map<HServerInfo,List<HRegionInfo>> clusterState)
Generate a global load balancing plan according to the specified map of server information to the most loaded regions of each server. |
static Map<HRegionInfo,HServerInfo> |
immediateAssignment(List<HRegionInfo> regions,
List<HServerInfo> servers)
Generates an immediate assignment plan to be used by a new master for regions in transition that do not have an already known destination. |
static HServerInfo |
randomAssignment(List<HServerInfo> servers)
|
static Map<HServerInfo,List<HRegionInfo>> |
retainAssignment(Map<HRegionInfo,HServerAddress> regions,
List<HServerInfo> servers)
Generates a bulk assignment startup plan, attempting to reuse the existing assignment information from META, but adjusting for the specified list of available/online servers available for assignment. |
static Map<HServerInfo,List<HRegionInfo>> |
roundRobinAssignment(List<HRegionInfo> regions,
List<HServerInfo> servers)
Generates a bulk assignment plan to be used on cluster startup using a simple round-robin assignment. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public List<LoadBalancer.RegionPlan> balanceCluster(Map<HServerInfo,List<HRegionInfo>> clusterState)
Order the regions to move from most recent to least.
clusterState
- Map of regionservers and their load/region information to
a list of their most loaded regions
public static Map<HServerInfo,List<HRegionInfo>> roundRobinAssignment(List<HRegionInfo> regions, List<HServerInfo> servers)
Takes a list of all the regions and all the servers in the cluster and returns a map of each server to the regions that it should be assigned.
Currently implemented as a round-robin assignment. Same invariant as load balancing, all servers holding floor(avg) or ceiling(avg). TODO: Use block locations from HDFS to place regions with their blocks
regions
- all regionsservers
- all servers
public static Map<HServerInfo,List<HRegionInfo>> retainAssignment(Map<HRegionInfo,HServerAddress> regions, List<HServerInfo> servers)
Takes a map of all regions to their existing assignment from META. Also takes a list of online servers for regions to be assigned to. Attempts to retain all assignment, so in some instances initial assignment will not be completely balanced.
Any leftover regions without an existing server to be assigned to will be assigned randomly to available servers.
regions
- regions and existing assignment from metaservers
- available servers
public static Map<HRegionInfo,HServerInfo> immediateAssignment(List<HRegionInfo> regions, List<HServerInfo> servers)
regions
- servers
-
public static HServerInfo randomAssignment(List<HServerInfo> servers)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |