偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

HBase看上去很美 我的項目失敗之路

數(shù)據(jù)庫 其他數(shù)據(jù)庫
隨著hadoop系列的興起,基于HDFS的大規(guī)模KV存儲系統(tǒng)HBase也進入“大規(guī)模使用階段”。網(wǎng)上的Hbase資料很多,學習成本正在下降。從公開的資料看,國外Facebook、國內(nèi)Taobao均宣稱在線上環(huán)境大規(guī)模使用Hbase。一切都讓人很興奮。于是,在項目中引入Hbase做存儲,最終卻選擇放棄。

HBase設(shè)計:看上去很美

HBase是模仿Google bigtable的開源產(chǎn)品,又是hadoop的衍生品,hadoop作為離線計算系統(tǒng)已經(jīng)得到業(yè)界的普遍認可,并經(jīng)過N多公司大規(guī)模使用的驗證,自然地認為HBase也將隨之獲得成功。

《HBase: The Definitive Guide》第8章講述HBase的架構(gòu),從架構(gòu)上看,其架構(gòu)很***:

LSM - 解決磁盤隨機寫問題(順序?qū)懖攀峭醯?;

HFile - 解決數(shù)據(jù)索引問題(只有索引才能高效讀);

WAL - 解決數(shù)據(jù)持久化(面對故障的持久化解決方案);

zooKeeper - 解決核心數(shù)據(jù)的一致性和集群恢復;

Replication - 引入類似MySQL的數(shù)據(jù)復制方案,解決可用性;

此外還有:自動分拆Split、自動壓縮(compaction,LSM的伴生技術(shù))、自動負載均衡、自動region遷移。

看上去如此美好,完全無需人工干預,貌似只要將HBase搭建好,一切問題HBase都將應對自如。面對如此***的系統(tǒng),不動心很難。

但是,如此***的系統(tǒng)或許也意味著背后的復雜性是不容忽略的。HBase的代碼量也不是一星半點的。假如系統(tǒng)工作不正常,誰來解決?這是至關(guān)重要的。

性能與測試

HBase系統(tǒng)自身提供了性能測試工具:./bin/HBase  org.apache.hadoop.HBase.PerformanceEvaluation,該工具提供了隨機讀寫、多客戶端讀寫等性能測試功能。根據(jù)工具測試的結(jié)果看,HBase的性能不算差。

對于HBase這樣的系統(tǒng)長期穩(wěn)定運行比什么都重要。然而,這或許就不那么"***"。

測試版本:HBase 0.94.1、 hadoop 1.0.2、 jdk-6u32-linux-x64.bin、snappy-1.0.5.tar.gz

測試HBase搭建:14臺存儲機器+2臺master、DataNode和regionserver放在一起。

HBase env配置:

 

  1. ulimit -n 65536 
  2. export HBASE_OPTS="$HBASE_OPTS -XX:+HeapDumpOnOutOfMemoryError -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode" 
  3. export HBASE_REGIONSERVER_OPTS="$HBASE_REGIONSERVER_OPTS -Xmx20g -Xms20g -Xmn512m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSIn 
  4. itiatingOccupancyFraction=60 -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:$HBASE_HOME/logs/gc-$(hostname)-hbase.lo 
  5. g" 

HBase-size.xml關(guān)鍵配置(根據(jù)《HBase: The Definitive Guide》第11章優(yōu)化):

 

  1.  <property> 
  2.                 <name>hbase.regionserver.handler.count</name> 
  3.                 <value>16</value> 
  4.                 <description>Count of RPC Listener instances spun up on RegionServers. 
  5.                 Same property is used by the Master for count of master handlers. 
  6.                 Default is 10. 
  7.                 </description> 
  8.         </property> 
  9.  
  10.         <property> 
  11.                 <name>hbase.regionserver.global.memstore.upperLimit</name> 
  12.                 <value>0.35</value> 
  13.                 <description>Maximum size of all memstores in a region server before new 
  14.                 updates are blocked and flushes are forced. Defaults to 40% of heap 
  15.                 </description> 
  16.         </property> 
  17.         <property> 
  18.                 <name>hbase.regionserver.global.memstore.lowerLimit</name> 
  19.                 <value>0.3</value> 
  20.                 <description>When memstores are being forced to flush to make room in 
  21.                 memory, keep flushing until we hit this mark. Defaults to 35% of heap. 
  22.                 This value equal to hbase.regionserver.global.memstore.upperLimit causes 
  23.                 the minimum possible flushing to occur when updates are blocked due to 
  24.                 memstore limiting. 
  25.                 </description> 
  26.         </property> 
  27.  
  28.         <property> 
  29.                 <name>hfile.block.cache.size</name> 
  30.                 <value>0.35</value> 
  31.                 <description> 
  32.                 Percentage of maximum heap (-Xmx setting) to allocate to block cache 
  33.                 used by HFile/StoreFile. Default of 0.25 means allocate 25%. 
  34.                 Set to 0 to disable but it's not recommended. 
  35.                 </description> 
  36.         </property> 
  37.  
  38.         <property> 
  39.                 <name>zookeeper.session.timeout</name> 
  40.                 <value>600000</value> 
  41.                 <description>ZooKeeper session timeout. 
  42.                 HBase passes this to the zk quorum as suggested maximum time for a 
  43.                 session (This setting becomes zookeeper's 'maxSessionTimeout').  See 
  44.                 http://hadoop.apache.org/zookeeper/docs/current/zookeeperProgrammers.html#ch_zkSessions 
  45.                 "The client sends a requested timeout, the server responds with the 
  46.                 timeout that it can give the client. " In milliseconds. 
  47.                 </description> 
  48.         </property> 
  49.  
  50. <property> 
  51.     <name>hbase.zookeeper.property.tickTime</name> 
  52.     <value>60000</value> 
  53. </property> 
  54.  
  55. <property> 
  56.     <name>hbase.regionserver.restart.on.zk.expire</name> 
  57.     <value>true</value> 
  58. </property> 
  59.  
  60.   <property> 
  61.     <name>hbase.hregion.majorcompaction</name> 
  62.     <value>0</value> 
  63.     <description>The time (in miliseconds) between 'major' compactions of all 
  64.     HStoreFiles in a region.  Default: 1 day(86400000). 
  65.     Set to 0 to disable automated major compactions. 
  66.     </description> 
  67.   </property> 
  68.  
  69.   <property> 
  70.     <name>hbase.hregion.max.filesize</name> 
  71.     <value>536870912000</value> 
  72.     <description> 
  73.     Maximum HStoreFile size. If any one of a column families' HStoreFiles has 
  74.     grown to exceed this value, the hosting HRegion is split in two. 
  75.     Default: 1G(1073741824).  Set 500G, disable file split! 
  76.     </description> 
  77.   </property> 

測試一:高并發(fā)讀(4w+/s) + 少量寫(允許分拆、負載均衡)

癥狀:1-2天后,HBase掛掉(系統(tǒng)性能極差,不到正常的10%)。其實并非全部掛掉,而是某些regionserver掛了,并在幾個小時內(nèi)引發(fā)其他regionserver掛掉。系統(tǒng)無法恢復:單獨啟regionserver無法恢復正常。重啟后正常。

測試二:高并發(fā)讀(4w+/s)

癥狀:1-2天后,HBase掛掉(系統(tǒng)性能極差,不到正常的10%)。后發(fā)現(xiàn)是由于zookeeper.session.timeout設(shè)置不正確導致(參見regionserver部分:http://HBase.apache.org/book.html#trouble)。重啟后正常。

測試三:高并發(fā)讀(4w+/s)

癥狀:1-2天后,HBase掛掉(系統(tǒng)性能極差,不到正常的10%)。從log未看出問題,但regionserver宕機,且datanode也宕機。重啟后正常。

測試四:高并發(fā)讀(4w+/s)+禁止分拆、禁止majorcompaction、禁止負載均衡(balance_switch命令)

癥狀:1-2天后,HBase掛掉(系統(tǒng)性能極差,不到正常的10%)。從log未看出問題,但regionserver宕機,且datanode也宕機。重啟后正常。

測試期間,還發(fā)現(xiàn)過:無法獲取".MATE."表的內(nèi)容(想知道regionserver的分布情況)、HBase無法正確停止、HBase無法正確啟動(日志恢復失敗,文件錯誤,最終手動刪除日志重啟)。

其他缺陷

HBase使用JAVA開發(fā),看上去很美的GC使用中代價可不小。HBase為了保證數(shù)據(jù)強一致性,每個key只能由一個regionserver提供服務。在下列情況下,HBase服務質(zhì)量都將受損:

1) GC CMS -- CMS回收內(nèi)存極其耗時,當HBase運行1-2天后,CMS可能耗時10分鐘,這期間該regionserver無法服務。CMS經(jīng)常被觸發(fā),這意味著HBase的服務經(jīng)常會因為GC操作而部分暫停!

2) regionserver宕機 - 為了強一致性,每個key只由一個regionserver提供服務,故當regionserver宕機后,相應的region即無法服務!

3) major compaction、split不可控 - 大量磁盤操作將極大影響服務。(levelDB也需要major compaction,只是使用更加可控的方式做壓縮,比如一次只有一個壓縮任務。是否影響服務,待測試)

4) 數(shù)據(jù)恢復 - 數(shù)據(jù)恢復期間設(shè)置WAL log的相關(guān)操作,在數(shù)據(jù)恢復期間regionserver無法服務!

結(jié)論

或許通過研究HBase的源碼可讓HBase穩(wěn)定運行,但從上述測試結(jié)果看:1)HBase還無法穩(wěn)定長期運行;2)HBase系統(tǒng)很脆弱,故障恢復能力差?;诖耍袛郒Base還無法滿足大規(guī)模線上系統(tǒng)的運維標準,只能放棄??紤]到HBase重啟基本可恢復正常,故HBase還是可作為離線存儲系統(tǒng)使用。

替代方案

面對大規(guī)模數(shù)據(jù),基于磁盤的存儲系統(tǒng)是必不可少的。google雖然公開了bigtable的設(shè)計,但未開源,但google開源了levelDB KV存儲系統(tǒng)庫(http://code.google.com/p/leveldb/)。levelDB采用C++實現(xiàn),1.7版本的代碼量大概2W,實現(xiàn)了LSM(自動壓縮)、LevelFile(基本同HFile),WAL,提供了簡單的Put、Get、Delete、Write(批量寫、事務功能)等接口。levelDB庫實現(xiàn)了單機單庫的磁盤存儲方案,開發(fā)者可根據(jù)自己需要開發(fā)定制的存儲系統(tǒng)(比如:數(shù)據(jù)Replication、自動調(diào)度、自動恢復、負載均衡等)。

參考文獻

HBase: The Definitive Guide

The Apache HBase™ Reference Guide

HBase運維碎碎念(尤其***的參考文獻): http://www.slideshare.net/NinGoo/HBase-8433555

責任編輯:彭凡 來源: 博客園
相關(guān)推薦

2012-11-14 09:48:57

HBase大數(shù)據(jù)

2011-12-08 08:58:28

JavaScript

2014-07-09 16:58:38

WIFI

2022-07-05 11:17:46

零信任安全技術(shù)網(wǎng)絡(luò)安全

2013-01-25 11:17:17

Gartner大數(shù)據(jù)傳感器

2009-08-03 14:09:13

SAP中國真相SAP

2019-12-02 12:50:52

LiFiWiFi通信網(wǎng)絡(luò)

2012-09-19 13:47:53

HTML5

2010-06-25 09:19:18

云計算應用

2024-03-26 13:03:16

NettyJavaNIO

2011-05-16 10:10:51

2010-09-02 09:32:26

私有云

2011-03-31 09:40:58

2016-10-19 09:17:15

HTML5Javascript可視化

2011-02-18 14:43:21

人才

2020-12-16 07:51:42

項目個人博客支付

2016-06-07 13:53:43

ios蘋果概念

2012-12-27 16:52:45

X PhoneGoogle摩托羅拉

2011-10-11 09:33:11

計算機工作

2021-03-01 14:47:00

Linux LiteWindows發(fā)行版
點贊
收藏

51CTO技術(shù)棧公眾號