在hbase中load balancing機制(2)

(問題)
hbase是如何執行load balancing的呢?

(方法)
上一篇文章中, 我們介紹了hbase 0.94的load balancing技術,
接著,在這一篇文章中, 我們將介紹load balancing在0.96版本中的改變,

hbase 0.96版本的昇級公告中, 其中就有一個特性是load balancing機制的更新,
在公告中是這樣子敘述新的load balancing機制:
New Region Balancer
 A new balancer using an algorithm similar to Simulated annealing or Greedy Hillclimbing factors in not only region count, the only attribute considered by the old balancer, but also region read/write load, locality, among other attributes, coming up with a balance decision.

在實作中,load balancer將先調用hbase叢集中RegionServer的狀態,
調用的方式如是透過java api查詢hbase叢集中RegionServer和Region狀態,
load balancer藉由這些資訊,取得每個Region的狀態,以決定:
(1) 是否要進行load balancing
(2) 如何平衡RegionServer之間的負載

對於第一個問題, hbase 0.96繼承了0.94的判斷方法,
依然是以 [floor(average * (1-slop)), ceil(average * (1+slop))] 計算可行區間,
如果有任何一台RegionServer上的Region超出可行區間,
則開始hbase叢集的load balancing.

針對如何平衡RegionServer之間的負載,
hbase 0.96考量了下列5個因素:
Region Load (一個RegionServer上有多少Region),
Table Load (一個RegionServer上有多少table),
Data Locality (Region搬移的目標RegionServer是否有HFile的備份),
Memstore Sizes(記憶體使用大小),
Storefile Sizes (硬碟使用大小).

在load balancing一開始, 會先根據公式計算出目前的cost,
在公式計算中, 則是把上述5個變量乘上權重, 加總後得到cost數值,
在過程中, load balancer將會{隨機, 根據Region個數, 根據資料在地性}選擇Region搬移,
並將搬移的結果計算出cost, 如果比原有的cost來得低, 則取代原有的配置,
如果較高, 則放棄這一次搬移, 重新決定搬移的Region和目標.
經過固定次數的嘗試後,將以最低cost的結果作為Region規劃,
進行hbase叢集內的負載平衡.




參考文章:
http://www.cnblogs.com/niurougan/p/3975433.html
https://issues.apache.org/jira/browse/HBASE-5959
http://www.cnblogs.com/cenyuhai/p/3650943.html
https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.html

留言

熱門文章

LTE筆記: RSRP, RSSI and RSRQ

[WiFi] WiFi 網路的識別: BSS, ESS, SSID, ESSID, BSSID

LTE筆記: 波束成型 (beamforming) 和天線陣列