Advanced HBase Schema Design. Berlin Buzzwords, June 2012 Lars George

Similar documents
ADVANCED HBASE. Architecture and Schema Design GeeCON, May Lars George Director EMEA Services

HBase. Леонид Налчаджи

Data Informatics. Seon Ho Kim, Ph.D.

HBASE INTERVIEW QUESTIONS

Ghislain Fourny. Big Data 5. Column stores

Comparing SQL and NOSQL databases

Ghislain Fourny. Big Data 5. Wide column stores

COSC 6339 Big Data Analytics. NoSQL (II) HBase. Edgar Gabriel Fall HBase. Column-Oriented data store Distributed designed to serve large tables

HBase... And Lewis Carroll! Twi:er,

Facebook. The Technology Behind Messages (and more ) Kannan Muthukkaruppan Software Engineer, Facebook. March 11, 2011

Introduction to BigData, Hadoop:-

Research on the Application of Bank Transaction Data Stream Storage based on HBase Xiaoguo Wang*, Yuxiang Liu and Lin Zhang

10 Million Smart Meter Data with Apache HBase

Big Data Hadoop Course Content

Lecture 36 12/4/15. CMPSC431W: Database Management Systems. Instructor: Yu- San Lin

NoSQL Databases. Amir H. Payberah. Swedish Institute of Computer Science. April 10, 2014

Using space-filling curves for multidimensional

Cloudera Kudu Introduction

BigTable: A Distributed Storage System for Structured Data

Faster HBase queries. Introducing hindex Secondary indexes for HBase. ApacheCon North America Rajeshbabu Chintaguntla

Big Data Infrastructure CS 489/698 Big Data Infrastructure (Winter 2017)

Copyright 2013, Oracle and/or its affiliates. All rights reserved.

Column-Family Databases Cassandra and HBase

Fattane Zarrinkalam کارگاه ساالنه آزمایشگاه فناوری وب

Big Data Infrastructure CS 489/698 Big Data Infrastructure (Winter 2016)

CSE-E5430 Scalable Cloud Computing Lecture 9

Column Stores and HBase. Rui LIU, Maksim Hrytsenia

Introduction to Hadoop. High Availability Scaling Advantages and Challenges. Introduction to Big Data

Typical size of data you deal with on a daily basis

Integration of Apache Hive

Scaling Up HBase. Duen Horng (Polo) Chau Assistant Professor Associate Director, MS Analytics Georgia Tech. CSE6242 / CX4242: Data & Visual Analytics

CA485 Ray Walshe NoSQL

Introduction to Column Oriented Databases in PHP

CS November 2018

Evolution of Big Data Facebook. Architecture Summit, Shenzhen, August 2012 Ashish Thusoo

CS November 2017

The State of Apache HBase. Michael Stack

HBase Security. Works in Progress Andrew Purtell, an Intel HBase guy

W b b 2.0. = = Data Ex E pl p o l s o io i n

HBase: Overview. HBase is a distributed column-oriented data store built on top of HDFS

HBase Solutions at Facebook

Hadoop & Big Data Analytics Complete Practical & Real-time Training

Presented by Sunnie S Chung CIS 612

COSC 6397 Big Data Analytics. Data Formats (III) HBase: Java API, HBase in MapReduce and HBase Bulk Loading. Edgar Gabriel Spring 2014.

Interactive SQL-on-Hadoop from Impala to Hive/Tez to Spark SQL to JethroData

Time Series Live 2017

April Final Quiz COSC MapReduce Programming a) Explain briefly the main ideas and components of the MapReduce programming model.

Apache HBase Andrew Purtell Committer, Apache HBase, Apache Software Foundation Big Data US Research And Development, Intel

HBASE MOCK TEST HBASE MOCK TEST III

Hadoop 2.x Core: YARN, Tez, and Spark. Hortonworks Inc All Rights Reserved

Strategies for Incremental Updates on Hive

Apache Accumulo 1.4 & 1.5 Features

BigTable. CSE-291 (Cloud Computing) Fall 2016

Voldemort. Smruti R. Sarangi. Department of Computer Science Indian Institute of Technology New Delhi, India. Overview Design Evaluation

A Fast and High Throughput SQL Query System for Big Data

REPORT ON DELIVERABLE Big Water Data Management engine. Ref. Ares(2015) /03/2015

Columnstore and B+ tree. Are Hybrid Physical. Designs Important?

SEARCHING BILLIONS OF PRODUCT LOGS IN REAL TIME. Ryan Tabora - Think Big Analytics NoSQL Search Roadshow - June 6, 2013

Apache Hive for Oracle DBAs. Luís Marques

ΕΠΛ 602:Foundations of Internet Technologies. Cloud Computing

Big Data Facebook

Understanding NoSQL Database Implementations

Time Series Storage with Apache Kudu (incubating)

MongoDB. David Murphy MongoDB Practice Manager, Percona

Getting to know. by Michelle Darling August 2013

How Apache Hadoop Complements Existing BI Systems. Dr. Amr Awadallah Founder, CTO Cloudera,

Making the Most of Hadoop with Optimized Data Compression (and Boost Performance) Mark Cusack. Chief Architect RainStor

Apache Kudu. Zbigniew Baranowski

CIB Session 12th NoSQL Databases Structures

Hadoop. Course Duration: 25 days (60 hours duration). Bigdata Fundamentals. Day1: (2hours)

Hive and Shark. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

Quadrant-Based MBR-Tree Indexing Technique for Range Query Over HBase

Bigtable. A Distributed Storage System for Structured Data. Presenter: Yunming Zhang Conglong Li. Saturday, September 21, 13

Part 1: Indexes for Big Data

Goal of the presentation is to give an introduction of NoSQL databases, why they are there.

MyRocks deployment at Facebook and Roadmaps. Yoshinori Matsunobu Production Engineer / MySQL Tech Lead, Facebook Feb/2018, #FOSDEM #mysqldevroom

Kathleen Durant PhD Northeastern University CS Indexes

CISC 7610 Lecture 2b The beginnings of NoSQL

Map Reduce Group Meeting

Bigtable: A Distributed Storage System for Structured Data By Fay Chang, et al. OSDI Presented by Xiang Gao

Importing and Exporting Data Between Hadoop and MySQL

Hadoop Beyond Batch: Real-time Workloads, SQL-on- Hadoop, and thevirtual EDW Headline Goes Here

Security and Performance advances with Oracle Big Data SQL

Trafodion Enterprise-Class Transactional SQL-on-HBase

HBase Java Client API

big picture parallel db (one data center) mix of OLTP and batch analysis lots of data, high r/w rates, 1000s of cheap boxes thus many failures

Enable Spark SQL on NoSQL Hbase tables with HSpark IBM Code Tech Talk. February 13, 2018

Distributed File Systems II

7. Query Processing and Optimization

THE ATLAS DISTRIBUTED DATA MANAGEMENT SYSTEM & DATABASES

CSE 444: Database Internals. Lectures 26 NoSQL: Extensible Record Stores

University of Waterloo Midterm Examination Sample Solution

Bigtable: A Distributed Storage System for Structured Data by Google SUNNIE CHUNG CIS 612

References. What is Bigtable? Bigtable Data Model. Outline. Key Features. CSE 444: Database Internals

HCatalog. Table Management for Hadoop. Alan F. Page 1

Practical MySQL indexing guidelines

Hadoop Overview. Lars George Director EMEA Services

Who Am I? Chris Larsen

Big Data and Scripting map reduce in Hadoop

Rails on HBase. Zachary Pinter and Tony Hillerson RailsConf 2011

Transcription:

Advanced HBase Schema Design Berlin Buzzwords, June 2012 Lars George lars@cloudera.com

About Me SoluDons Architect @ Cloudera Apache HBase & Whirr CommiIer Author of HBase The Defini.ve Guide Working with HBase since end of 2007 Organizer of the Munich OpenHUG

Agenda 1 Overview of HBase 2 Schema Design 3 Examples 4 Wrap up 3

HBase Tables

HBase Tables

HBase Tables

HBase Tables

HBase Tables

HBase Tables

HBase Tables

Physical Model: HBase Tables and Regions Table is made up of any number if regions Region is specified by its startkey and endkey Each region may live on a different node and is made up of several HDFS files and blocks, each of which is replicated by Hadoop

DistribuDon

Storage SeparaDon Column Families allow for separadon of data Used by Columnar Databases for fast analydcal queries, but on column level only Allows different or no compression depending on the content type Segregate informadon based on access paiern Data is stored in one or more storage file, called HFiles

Fold, Store, and Shi\

Fold, Store, and Shi\ Logical layout does not match physical one All values are stored with the full coordinates, including: Row Key, Column Family, Column Qualifier, and Timestamp Folds columns into row per column NULLs are cost free as nothing is stored Versions are muldple rows in folded table

Logical Model: HBase Tables Tables are sorted by Row in lexicographical order Table schema only defines its column families Each family consists of any number of columns Each column consists of any number of versions Columns only exist when inserted, NULLs are free Columns within a family are sorted and stored together Everything except table names are byte[] (Table, Row, Family:Column, Timestamp) - > Value

Column Family vs. Column Use only a few column families Causes many files that need to stay open per region plus class overhead per family Best used when logical separadon between data and meta columns SorDng per family can be used to convey applicadon logic or access paiern

Key Cardinality

Key Cardinality The best performance is gained from using row keys Time range bound reads can skip store files So can Bloom Filters SelecDng column families reduces the amount of data to be scanned Pure value based filtering is a full table scan Filters o\en are too, but reduce network traffic

Key/Table Design Crucial to gain best performance Why do I need to know? Well, you also need to know that RDBMS is only working well when columns are indexed and query plan is OK Absence of secondary indexes forces use of row key or column name sordng Transfer muldple indexes into one Generate large table - > Good since fits architecture and spreads across cluster

DDI Stands for DenormalizaDon, DuplicaDon and Intelligent Keys Needed to overcome shortcomings of architecture DenormalizaDon - > Replacement for JOINs DuplicaDon - > Design for reads Intelligent Keys - > Implement indexing and sordng, opdmize reads

Key Design

Key Design Summary Based on access paiern, either use sequendal or random keys O\en a combinadon of both is needed Overcome architectural limitadons Neither is necessarily bad Use bulk import for sequendal keys and reads Random keys are good for random access paierns

Pre- materialize Everything Achieve one read per customer request if possible Otherwise keep at lowest number Reads between 10ms (cache miss) and 1ms (cache hit) Use MapReduce to compute exacts in batch Store and merge updates live Use incrementcolumnvalue MoIo: Design for Reads

RelaDonal Model

Muddled Up!

Remodeling

WTH?

Example: OpenTSDB Metric Type, Tags are stored as IDs Periodically rolled up

Summary Design for Use- Case Read, Write, or Both? Avoid Hotspomng Consider using IDs instead of full text Leverage Column Family to HFile reladon Shi\ details to appropriate posidon Composite Keys Column Qualifiers

Summary (cont.) Schema design is a combinadon of Designing the keys (row and column) Segregate data into column families Choose compression and block sizes Similar techniques are needed to scale most systems Add indexes, parddon data, consistent hashing DenormalizaDon, DuplicaDon, and Intelligent Keys (DDI)

QuesDons? Email: lars@cloudera.com TwiIer: @larsgeorge

Tall- Narrow vs. Flat- Wide Tables Rows do not split Might end up with one row per region Same storage footprint Put more details into the row key SomeDmes dummy column only Make use of pardal key scans Tall with Scans, Wide with Gets Atomicity only on row level Example: Large graphs, stored as adjacency matrix

Example: Mail Inbox <userid> : <colfam> : <messageid> : <timestamp> : <email-message> 12345 : data : 5fc38314-e290-ae5da5fc375d : 1307097848 : "Hi Lars,..." 12345 : data : 725aae5f-d72e-f90f3f070419 : 1307099848 : "Welcome, and..." 12345 : data : cc6775b3-f249-c6dd2b1a7467 : 1307101848 : "To Whom It..." 12345 : data : dcbee495-6d5e-6ed48124632c : 1307103848 : "Hi, how are..." or 12345-5fc38314-e290-ae5da5fc375d : data : : 1307097848 : "Hi Lars,..." 12345-725aae5f-d72e-f90f3f070419 : data : : 1307099848 : "Welcome, and..." 12345-cc6775b3-f249-c6dd2b1a7467 : data : : 1307101848 : "To Whom It..." 12345-dcbee495-6d5e-6ed48124632c : data : : 1307103848 : "Hi, how are..." è Same Storage Requirements

ParDal Key Scans Key <userid> <userid>-<date> <userid>-<date>-<messageid> <userid>-<date>-<messageid>-<attachmentid> Descrip2on Scan over all messages for a given user ID Scan over all messages on a given date for the given user ID Scan over all parts of a message for a given user ID and date Scan over all aiachments of a message for a given user ID and date

SequenDal Keys <timestamp><more key>: {CF: {CQ: {TS : Val}}} Hotspomng on Regions: bad! Instead do one of the following: SalDng Prefix <timestamp> with distributed value Binning or buckedng rows across regions Key field swap/promodon Move <more key> before the Dmestamp (see OpenTSDB later) RandomizaDon Move <timestamp> out of key

SalDng Prefix row keys to gain spread Use well known or numbered prefixes Use modulo to spread across servers Enforce common data stay close to each other for subsequent scanning or MapReduce processing 0_rowkey1, 1_rowkey2, 2_rowkey3 0_rowkey4, 1_rowkey5, 2_rowkey6 Sorted by prefix first 0_rowkey1 0_rowkey4 1_rowkey2 1_rowkey5

Hashing vs. SequenDal Keys Uses hashes for best spread Use for example MD5 to be able to recreate key Key = MD5(customerID) Counter producdve for range scans Use sequendal keys for locality Makes use of block caches May tax one server overly, may be avoided by saldng or splimng regions while keeping them small

ConfiguraDon Layers (aka OSI for HBase )

HBase Architecture (cont.)

Write- Ahead- Log (WAL) Flow

Write- Ahead- Log (cont.)

HFile and KeyValue

Raw Data View $./bin/hbase org.apache.hadoop.hbase.io.hfile.hfile -f file:///tmp/ hbase-larsgeorge/hbase/testtable/272a63b23bdb5fae759be5192cabc0ce/ f1/4992515006010131591 -p K: row1/f1:/1290345071149/put/vlen=6 V: value1 K: row2/f1:/1290345078351/put/vlen=6 V: value2 K: row3/f1:/1290345089750/put/vlen=6 V: value3 K: row4/f1:/1290345095724/put/vlen=6 V: value4 K: row5/f1:c1/1290347447541/put/vlen=6 V: value5 K: row6/f1:c2/1290347461068/put/vlen=6 V: value6 K: row7/f1:c1/1290347581879/put/vlen=7 V: value10 K: row7/f1:c1/1290347469553/put/vlen=6 V: value7 K: row7/f1:c10/1290348157074/deletecolumn/vlen=0 V: K: row7/f1:c10/1290347625771/put/vlen=7 V: value11 K: row7/f1:c11/1290347971849/put/vlen=7 V: value14 K: row7/f1:c12/1290347979559/put/vlen=7 V: value15 K: row7/f1:c13/1290347986384/put/vlen=7 V: value16 K: row7/f1:c2/1290347569785/put/vlen=6 V: value8 K: row7/f1:c3/1290347575521/put/vlen=6 V: value9 K: row7/f1:c8/1290347638008/put/vlen=7 V: value13 K: row7/f1:c9/1290347632777/put/vlen=7 V: value12