Post on 26-Jun-2015
알고 쓰자! HBase
데이터기술팀 유응섭
HBase의 특징
부족한 기능에 대한 보완
주의사항
HBase?
HBase?
Hadoop Database
for Real-time Services
HBase는 이런 점이 좋아요
Scalable
노드 수에 비례해서 읽기 쓰기 성능 증가
수 백대의 노드
Peta Byte 수준의 데이터
Strong Consistency
Not Eventual Consistency
클라이언트는 항상 최신 데이터를 엑세스
메시징 서비스 등에 적합
Ordered Key-value
Row Key, Column Key
Range Scan 가능
이런 기능은 부족해요
이런 기능은 부족해요
복잡한 오퍼레이션
Secondary Index
…
부족한 기능은
어떻게 보완할까요?
Coprocessor
Coprocessor
Endpoint = RDBMS Procedure
Observer = RDBMS Trigger
서버 프로세스 내에서 동작
Endpoint
Parallel Execution
MapReduce와 유사한 방식
Observer
서버에서 발생하는 이벤트에 반응
pre/post hook 가능
부족한 기능에 대한 보완
Endpoint: Group-by Operator
Observer: Secondary Index
Group-by Operator
select c1, c2, count(v1) from tab group by c1, c2;
Configuration conf = HBaseConfiguration.create(); GroupByClient client = new GroupByClient(conf); long queryID = client.aggregate("tab", "d:c1,d:c2", "count(d:v1)"); GroupByClient.printResult(queryID);
Group-by Operator
Group-by Operator
Performance 9 Region Servers. 24GB RAM. 4Cores(with HT). 4 HDDs
1억 건. 8.6GB(Snappy. 압축율 약 28%)
38
640
0
200
400
600
800
Duration
GroupBy
Count(shell)
(단위: 초)
Secondary Index
Secondary Index
Dual Write
Secondary Index
Dual Write
Observer를 이용한 구현
클라이언트는 코드 수정이 필요 없음
부하를 많이 주었을 때 문제 발생해서 보류
Secondary Index
Dual Write
HIndexedTable extends HTable
Override put/scan method
Secondary Index
IndexManager
Secondary Index
INDEX_META table
Secondary Index
Scan Performance 9 Region Servers. 24GB RAM. 4Cores(with HT). 4 HDDs
1억 건. 8.6GB(Snappy. 압축율 약 28%)
308
172
7 1 0
100
200
300
400
Filtered Scan
(w/o index)
1% 0.10% 0.01%
(단위: 초)
HBase를 쓸 때
주의할 점은 뭐가 있나요?
Durability
Durability
HBase에 성공적으로 저장된 데이터는
유실 되어서는 안 된다
Durability
HBase는 HDFS에 데이터파일을 저장
HDFS는 kernel buffer로 flush만 함
kernel buffer는 정전 시 유실 됨
Durability
다수 노드 장애 시
데이터 복구 불가능할 수 있음
UPS, queue & snapshot
Durability
다음 HDFS버전에서 해결될 예정
감사합니다.
Q&A
유응섭 rspeed@daumcorp.com