SlideShare a Scribd company logo
1 of 50
Download to read offline
HBase
                                  Amandeep Khurana
                           University of California, Santa Cruz
                                   Twitter: @amansk
                                  amansk@gmail.com
                             www.amandeepkhurana.com




Tuesday, August 17, 2010
How did it start?

                    • At Google
                           •   Lots of semi structured data

                           •   Commodity hardware

                           •   Horizontal scalability

                           •   Tight integration with MapReduce



                                                        2
Tuesday, August 17, 2010
Why NoSQL?

                    • RDBMS don’t scale
                           •   Typically large monolithic systems

                           •   Hard to shard

                           •   Specialized hardware.. expensive!

                    • Buzzword!

                                                    3
Tuesday, August 17, 2010
Google BigTable
                    •      Distributed multi level map
                    •      Fault tolerant, persistent
                    •      Scalable
                    •      Runs on commodity hardware
                    •      Self managing
                    •      Large number of read/write ops
                    •      Fast scans

                                                 4
Tuesday, August 17, 2010
HBase

                    • Open source BigTable
                    • HDFS as underlying DFS
                    • ZooKeeper as lock service
                    • Tight integration with Hadoop MapReduce

                                        5
Tuesday, August 17, 2010
HBase
                    •      Data model
                    •      Architecture, implementation
                           •   Regions, Region Servers etc

                    •      API
                    •      Current status and future direction
                    •      Use cases
                    •      How to think HBase (or NoSQL)?

                                                     6
Tuesday, August 17, 2010
Data Model
                    • Sparse, multi dimensional map
                           (row, column, timestamp)       cell


                    • Column = Column Family:Column Qualifier
                                                                  Columns
                                               Fam1:Qual1


             Rows
                                                                 t1
                     AK                               v1
                                                                      Timestamps


                                                      7
Tuesday, August 17, 2010
Data Model
                    • Sparse, multi dimensional map
                           (row, column, timestamp)       cell


                    • Column = Column Family:Column Qualifier
                                                                   Columns
                                               Fam1:Qual1


             Rows
                                                                  t1
                     AK                               v1     t2
                                                 v2
                                                                       Timestamps

                                                 t2>t1
                                                      7
Tuesday, August 17, 2010
Regions

                    • Region: Contiguous set of lexicographically
                           sorted rows
                           •   hbase.hregion.max.filesize (default 256MB)

                    • Regions hosted by Region Servers

                                                   8
Tuesday, August 17, 2010
Regions and Splitting
            row1


          row256



          row257



          row600




                                     9
Tuesday, August 17, 2010
Regions and Splitting
            row1


          row256



          row257



          row600
           Writes




                                     9
Tuesday, August 17, 2010
Regions and Splitting
            row1


          row256


          row257

          row400

          row401

          row600




                                     9
Tuesday, August 17, 2010
System Structure

                           M
                           a
                           p      Region Servers       Master
                           R
                           e
                           d
                           u
                           c
                           e    HDFS           ZooKeeper




                                          10
Tuesday, August 17, 2010
Master

                    • Region splitting
                    • Load balancing
                    • Metadata operations
                    • Multiple masters for failover

                                          11
Tuesday, August 17, 2010
ZooKeeper

                    • Master election
                    • Locate -ROOT- region
                    • Region Server membership

                                       12
Tuesday, August 17, 2010
Where is my row?
                    • 3 level hierarchical lookup scheme   MyTable
                                                 .META.
                                                            MyRow


                                   -ROOT-

                       ZooKeeper




                                            13
Tuesday, August 17, 2010
Where is my row?
                    • 3 level hierarchical lookup scheme   MyTable
                                                 .META.
                                                            MyRow


                                   -ROOT-

                       ZooKeeper




                                            13
Tuesday, August 17, 2010
Where is my row?
                    • 3 level hierarchical lookup scheme           MyTable
                                                          .META.
                                                                    MyRow


                                        -ROOT-

                       ZooKeeper

                                   Row per META region




                                                     13
Tuesday, August 17, 2010
Where is my row?
                    • 3 level hierarchical lookup scheme                         MyTable
                                                               .META.
                                                                                  MyRow


                                        -ROOT-

                       ZooKeeper

                                   Row per META region


                                                          Row per table region




                                                     13
Tuesday, August 17, 2010
Where is my row?
                    • 3 level hierarchical lookup scheme                         MyTable
                                                               .META.
                                                                                  MyRow


                                        -ROOT-

                       ZooKeeper

                                   Row per META region


                                                          Row per table region




                                                     13
Tuesday, August 17, 2010
Region

                                   Memstore

                               HLog
                            (Append only
                           WAL on HDFS)
                                               HFile         HFile
                                              (on HDFS)     (on HDFS)
                           (Sequence File)
                            (one per RS)

                                                                                 Region

                               HFile: Immutable sorted map (byte[]     byte[])
                                   (row, column, timestamp)   cell value




                                                       14
Tuesday, August 17, 2010
Region
            Write
                                   Memstore

                               HLog
                            (Append only
                           WAL on HDFS)
                                               HFile         HFile
                                              (on HDFS)     (on HDFS)
                           (Sequence File)
                            (one per RS)

                                                                                 Region

                               HFile: Immutable sorted map (byte[]     byte[])
                                   (row, column, timestamp)   cell value




                                                       14
Tuesday, August 17, 2010
Region

                                   Memstore

                               HLog
                            (Append only
                           WAL on HDFS)
                                               HFile         HFile
                                              (on HDFS)     (on HDFS)
                           (Sequence File)
                            (one per RS)

                                                                                 Region

                               HFile: Immutable sorted map (byte[]     byte[])
                                   (row, column, timestamp)   cell value




                                                       14
Tuesday, August 17, 2010
Region

                                   Memstore                 Flush

                               HLog
                            (Append only                                  Small
                           WAL on HDFS)
                                               HFile           HFile
                           (Sequence File)
                                              (on HDFS)      (on HDFS)    HFile
                            (one per RS)

                                                                                 Region

                               HFile: Immutable sorted map (byte[]     byte[])
                                   (row, column, timestamp)   cell value




                                                       14
Tuesday, August 17, 2010
Region

                                   Memstore

                               HLog
                            (Append only                                  Small
                           WAL on HDFS)
                                               HFile         HFile
                           (Sequence File)
                                              (on HDFS)     (on HDFS)     HFile
                            (one per RS)

                                                                                 Region

                               HFile: Immutable sorted map (byte[]     byte[])
                                   (row, column, timestamp)   cell value




                                                       14
Tuesday, August 17, 2010
Region

                                   Memstore

                               HLog
                            (Append only                                  Small
                           WAL on HDFS)
                                               HFile          HFile
                           (Sequence File)
                                              (on HDFS)      (on HDFS)    HFile
                            (one per RS)                    Compaction
                                                                                 Region

                               HFile: Immutable sorted map (byte[]     byte[])
                                   (row, column, timestamp)   cell value




                                                       14
Tuesday, August 17, 2010
Region

                                   Memstore

                               HLog
                            (Append only
                           WAL on HDFS)
                           (Sequence File)
                            (one per RS)                  Compaction
                                                                                 Region

                               HFile: Immutable sorted map (byte[]     byte[])
                                   (row, column, timestamp)   cell value




                                                     14
Tuesday, August 17, 2010
Region

                                   Memstore

                               HLog
                            (Append only
                           WAL on HDFS)
                                                            HFile
                                                           (on HDFS)
                           (Sequence File)
                            (one per RS)

                                                                                 Region

                               HFile: Immutable sorted map (byte[]     byte[])
                                   (row, column, timestamp)   cell value




                                                     14
Tuesday, August 17, 2010
Region

                                   Memstore

                               HLog
                            (Append only
                           WAL on HDFS)
                                               HFile         HFile       HFile
                                              (on HDFS)     (on HDFS)   (on HDFS)
                           (Sequence File)
                            (one per RS)

                                                                             Region




                                                       15
Tuesday, August 17, 2010
Region

            Read
                                   Memstore

                               HLog
                            (Append only
                           WAL on HDFS)
                                               HFile         HFile       HFile
                                              (on HDFS)     (on HDFS)   (on HDFS)
                           (Sequence File)
                            (one per RS)

                                                                             Region




                                                       15
Tuesday, August 17, 2010
Ways to access
                    •      Java
                    •      REST
                    •      Thrift
                    •      Scala
                    •      Jython
                    •      Groovy DSL
                    •      Ruby shell
                    •      Java MR, Cascading, Pig, Hive

                                                    16
Tuesday, August 17, 2010
Java API
                    •      Get
                    •      Put
                    •      Delete
                    •      Scan
                    •      IncrementColumnValue
                    •      TableInputFormat - MapReduce Source
                    •      TableOutputFormat - MapReduce Sink

                                             17
Tuesday, August 17, 2010
Other Features
                    •      Compression
                    •      In memory column families
                    •      Multiple masters
                    •      Rolling restart
                    •      Bloom filters
                    •      Efficient bulk loads
                    •      Source and sink for Hive, Pig, Cascading

                                                 18
Tuesday, August 17, 2010
Things being worked on

                    • Master rewrite
                           •   Move more stuff into ZooKeeper

                    • Column family based access control
                    • Inter cluster replication (managed by ZK)
                    • Store Lucene indexes (HBasene)
                                                  19
Tuesday, August 17, 2010
Use Cases



Tuesday, August 17, 2010
HBase @ SU*
                    • Backend for su.pr
                           •   Real time serving + MR analytics (separate clusters)

                           •   50% cascading, 50% java MR

                           •   Prod cluster (~20 nodes) serves 20k requests/sec

                    • All new features are backed by HBase
                    • Hardware: 2xi7, 24GB RAM, 4x1TB
*Source: Personal communication with
                                                    21
      J-D Cryans, StumbleUpon
Tuesday, August 17, 2010
HBase @ Mozilla*
                    •      Socorro - crash reporting system
                           •   Catch, process and present crash info for Firefox, Thunderbird,
                               Fennec, Camino, Seamonkey

                           •   1.5m crash reports/day

                    •      Earlier: NFS, PostgreSQL
                    •      17 node production cluster
                           •   Dual Quad Core + 24GB RAM + 4x1TB

                    •      Some user facing reports still served by PostgreSQL.
                           Being ported to HBase in next Socorro version

*Source: http://blog.mozilla.com/webdev/2010/07/26/
                                                         22
moving-socorro-to-hbase/
Tuesday, August 17, 2010
Data Integration*
                    • Multiple heterogenous data sources
                    • Notion of connected data
                           •   Think RDF

                    • Graph connecting data elements across
                           systems
                    • Store in HBase, build transitive closures
                    • Pattern mining
*Source: ClouDFuse - Scalable data integration in the
                                                        23
cloud, MS Project, Amandeep Khurana, UC Santa Cruz
Tuesday, August 17, 2010
HBase @ Trend Micro*

                    • Store threat information - Smart Protection
                           Network
                    • Open source cloud computing initiative -
                           TCloud
                    • Primarily run off EC2

*Source: https://hbase.s3.amazonaws.com/hbase/HBase-
                                                       24
Trend-HUG10.pdf
Tuesday, August 17, 2010
HBase @ Yahoo*

                    • Content optimization
                    • Meta-data about content stored in HBase
                    • Used for extracting item features
                    • Used in conjunction with PNUTS, Hadoop
                    • Process 100s of GB in each run
*Source: http://www.slideshare.net/ydn/7-online-
                                                   25
contentoptimizationhadoopsummit2010
Tuesday, August 17, 2010
HBase @ Twitter*
                    • 7TB/day incoming data, increasing
                    • Analytics
                    • People search
                    • Building new solutions on HBase
                    • Part of a much larger scheme of things
                           •   Scribe, Crane, Pig, MySQL, Cassandra, Oink,
                               Elephant Bird, Birdbrain, Hadoop
*Sources: http://www.slideshare.net/kevinweil/nosql-at-
twitter-nosql-eu-2010
http://www.slideshare.net/ydn/3-hadoop-
pigattwitterhadoopsummit2010                              26
Tuesday, August 17, 2010
Others
                  •        Facebook
                                               •   Powerset
                  •        Flurry
                                               •   WorldLingo
                  •        Adobe
                                               •   Lily
                  •        Runa
                                               •   Drawn To Scale
                  •        GumGum
                                               •   RapLeaf
                  •        Openplaces
                                               •   ...
                  •        Meetup.com

                                          27
Tuesday, August 17, 2010
How to think in HBase?



Tuesday, August 17, 2010
HBase v/s RDBMS


                • Neither solves all problems
                           •   It’s really a wrong comparison

                           •   But puts things in context




                                                    29
Tuesday, August 17, 2010
HBase v/s RDBMS
                                   HBase                                    RDBMS
                     Column oriented                        Row oriented (mostly)
                     Flexible schema, add columns on the
                                                            Fixed schema
                     fly
                     Good with sparse tables                Not optimized for sparse tables
                     No query language                      SQL
                     Wide tables                            Narrow tables
                                                            Optimized for joins (small, fast ones
                     Joins using MR - not optimized
                                                            too!)
                     Tight integration with MR              Not really...




                                                           30
Tuesday, August 17, 2010
HBase v/s RDBMS
                                    HBase                                 RDBMS
                     De-normalize your data               Normalize as you can
                     Horizontal scalability. Just add
                                                          Hard to shard and scale
                     hardware
                     Consistent                           Consistent
                     No transactions                      Transactional
                     Good for semi structured data as well
                                                           Good for structured data
                     as structured data




                                                         31
Tuesday, August 17, 2010
HBase v/s RDBMS




                                  32
Tuesday, August 17, 2010
HBase v/s RDBMS

                   Rule:You probably don’t need HBase if your
                  data can easily fit and be processed on a single
                                    RDBMS box.




                                        32
Tuesday, August 17, 2010
HBase v/s RDBMS

                   Rule:You probably don’t need HBase if your
                  data can easily fit and be processed on a single
                                    RDBMS box.

                 But then, you are at Hadoop Day, so it probably
                                      can’t!



                                        32
Tuesday, August 17, 2010
Q&A



Tuesday, August 17, 2010

More Related Content

Viewers also liked

Nutrifect IBO Plan
Nutrifect IBO PlanNutrifect IBO Plan
Nutrifect IBO PlanNutrifect
 
Pharmapack 2012 Competitive Intelligence Report
Pharmapack 2012 Competitive Intelligence ReportPharmapack 2012 Competitive Intelligence Report
Pharmapack 2012 Competitive Intelligence ReportViedoc
 
IT & Big Data 2012 Report
IT & Big Data 2012 ReportIT & Big Data 2012 Report
IT & Big Data 2012 ReportViedoc
 
Genesics2 (2011) Competitive Intelligence Report
Genesics2 (2011) Competitive Intelligence ReportGenesics2 (2011) Competitive Intelligence Report
Genesics2 (2011) Competitive Intelligence ReportViedoc
 
Charalampos Lymperopoulos Works and Projects
Charalampos Lymperopoulos Works and ProjectsCharalampos Lymperopoulos Works and Projects
Charalampos Lymperopoulos Works and ProjectsHarris Lymperopoulos
 
Me myself and i (h)
 Me myself and i (h) Me myself and i (h)
Me myself and i (h)Matt Carey
 
20140329 brand management chapter 4 iba mba48 e
20140329 brand management chapter 4 iba mba48 e20140329 brand management chapter 4 iba mba48 e
20140329 brand management chapter 4 iba mba48 eZeeshan Huq
 
20130603 brand management chapter 6
20130603 brand management chapter 620130603 brand management chapter 6
20130603 brand management chapter 6Zeeshan Huq
 
20140412 brand management chapter 6 iba mba48 e
20140412 brand management chapter 6 iba mba48 e20140412 brand management chapter 6 iba mba48 e
20140412 brand management chapter 6 iba mba48 eZeeshan Huq
 
DSN Newsletter August 2010 Vol 1 Issue 1
DSN Newsletter August 2010 Vol 1 Issue 1DSN Newsletter August 2010 Vol 1 Issue 1
DSN Newsletter August 2010 Vol 1 Issue 1Phil Lane Jr.
 
DSN's and the Digital 4th Way
DSN's and the Digital 4th WayDSN's and the Digital 4th Way
DSN's and the Digital 4th WayPhil Lane Jr.
 
P5 &_p6_cl_powerpoint_slides_2011
P5  &_p6_cl_powerpoint_slides_2011P5  &_p6_cl_powerpoint_slides_2011
P5 &_p6_cl_powerpoint_slides_2011alanpillay79
 
New FWII DSN Platform - Trunity
New FWII DSN Platform - TrunityNew FWII DSN Platform - Trunity
New FWII DSN Platform - TrunityPhil Lane Jr.
 
Miniolimpiada de 3°abril
Miniolimpiada de 3°abrilMiniolimpiada de 3°abril
Miniolimpiada de 3°abrilCEASIMON
 

Viewers also liked (16)

Nutrifect IBO Plan
Nutrifect IBO PlanNutrifect IBO Plan
Nutrifect IBO Plan
 
Pharmapack 2012 Competitive Intelligence Report
Pharmapack 2012 Competitive Intelligence ReportPharmapack 2012 Competitive Intelligence Report
Pharmapack 2012 Competitive Intelligence Report
 
IT & Big Data 2012 Report
IT & Big Data 2012 ReportIT & Big Data 2012 Report
IT & Big Data 2012 Report
 
Genesics2 (2011) Competitive Intelligence Report
Genesics2 (2011) Competitive Intelligence ReportGenesics2 (2011) Competitive Intelligence Report
Genesics2 (2011) Competitive Intelligence Report
 
Charalampos Lymperopoulos Works and Projects
Charalampos Lymperopoulos Works and ProjectsCharalampos Lymperopoulos Works and Projects
Charalampos Lymperopoulos Works and Projects
 
Me myself and i (h)
 Me myself and i (h) Me myself and i (h)
Me myself and i (h)
 
Mt 1
Mt 1Mt 1
Mt 1
 
20140329 brand management chapter 4 iba mba48 e
20140329 brand management chapter 4 iba mba48 e20140329 brand management chapter 4 iba mba48 e
20140329 brand management chapter 4 iba mba48 e
 
20130603 brand management chapter 6
20130603 brand management chapter 620130603 brand management chapter 6
20130603 brand management chapter 6
 
20140412 brand management chapter 6 iba mba48 e
20140412 brand management chapter 6 iba mba48 e20140412 brand management chapter 6 iba mba48 e
20140412 brand management chapter 6 iba mba48 e
 
DSN Newsletter August 2010 Vol 1 Issue 1
DSN Newsletter August 2010 Vol 1 Issue 1DSN Newsletter August 2010 Vol 1 Issue 1
DSN Newsletter August 2010 Vol 1 Issue 1
 
2 premedical viruses_a
2 premedical viruses_a2 premedical viruses_a
2 premedical viruses_a
 
DSN's and the Digital 4th Way
DSN's and the Digital 4th WayDSN's and the Digital 4th Way
DSN's and the Digital 4th Way
 
P5 &_p6_cl_powerpoint_slides_2011
P5  &_p6_cl_powerpoint_slides_2011P5  &_p6_cl_powerpoint_slides_2011
P5 &_p6_cl_powerpoint_slides_2011
 
New FWII DSN Platform - Trunity
New FWII DSN Platform - TrunityNew FWII DSN Platform - Trunity
New FWII DSN Platform - Trunity
 
Miniolimpiada de 3°abril
Miniolimpiada de 3°abrilMiniolimpiada de 3°abril
Miniolimpiada de 3°abril
 

Similar to HBase Deep Dive

QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!Matt Butcher
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDBJohn Wood
 
Non Relational Databases And World Domination
Non Relational Databases And World DominationNon Relational Databases And World Domination
Non Relational Databases And World DominationJason Davies
 
State of Cassandra, August 2010
State of Cassandra, August 2010State of Cassandra, August 2010
State of Cassandra, August 2010jbellis
 
Pregel: A System for Large-Scale Graph Processing
Pregel: A System for Large-Scale Graph ProcessingPregel: A System for Large-Scale Graph Processing
Pregel: A System for Large-Scale Graph ProcessingChris Bunch
 
Andy Parsons Pivotal June 2011
Andy Parsons Pivotal June 2011Andy Parsons Pivotal June 2011
Andy Parsons Pivotal June 2011Andy Parsons
 
Database Scalability Patterns
Database Scalability PatternsDatabase Scalability Patterns
Database Scalability PatternsRobert Treat
 
Designing for Massive Scalability at BackType #bigdatacamp
Designing for Massive Scalability at BackType #bigdatacampDesigning for Massive Scalability at BackType #bigdatacamp
Designing for Massive Scalability at BackType #bigdatacampMichael Montano
 
Cassandra 0.7, Los Angeles High Scalability Group
Cassandra 0.7, Los Angeles High Scalability GroupCassandra 0.7, Los Angeles High Scalability Group
Cassandra 0.7, Los Angeles High Scalability Groupjbellis
 
Odnoklassniki.ru Architecture
Odnoklassniki.ru ArchitectureOdnoklassniki.ru Architecture
Odnoklassniki.ru ArchitectureDmitry Buzdin
 
Databases for Storage Engineers
Databases for Storage EngineersDatabases for Storage Engineers
Databases for Storage EngineersThomas Kejser
 
Big Bad PostgreSQL: BI on a Budget
Big Bad PostgreSQL: BI on a BudgetBig Bad PostgreSQL: BI on a Budget
Big Bad PostgreSQL: BI on a BudgetJoshua L. Davis
 
Hadoop: A Hands-on Introduction
Hadoop: A Hands-on IntroductionHadoop: A Hands-on Introduction
Hadoop: A Hands-on IntroductionClaudio Martella
 
Yet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRepYet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRepDenish Patel
 
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGuillaume Laforge
 
Seattle hug 2010
Seattle hug 2010Seattle hug 2010
Seattle hug 2010Abe Taha
 

Similar to HBase Deep Dive (20)

No sql findings
No sql findingsNo sql findings
No sql findings
 
QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDB
 
Non Relational Databases And World Domination
Non Relational Databases And World DominationNon Relational Databases And World Domination
Non Relational Databases And World Domination
 
State of Cassandra, August 2010
State of Cassandra, August 2010State of Cassandra, August 2010
State of Cassandra, August 2010
 
NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
Pregel: A System for Large-Scale Graph Processing
Pregel: A System for Large-Scale Graph ProcessingPregel: A System for Large-Scale Graph Processing
Pregel: A System for Large-Scale Graph Processing
 
Andy Parsons Pivotal June 2011
Andy Parsons Pivotal June 2011Andy Parsons Pivotal June 2011
Andy Parsons Pivotal June 2011
 
Database Scalability Patterns
Database Scalability PatternsDatabase Scalability Patterns
Database Scalability Patterns
 
Designing for Massive Scalability at BackType #bigdatacamp
Designing for Massive Scalability at BackType #bigdatacampDesigning for Massive Scalability at BackType #bigdatacamp
Designing for Massive Scalability at BackType #bigdatacamp
 
Cassandra 0.7, Los Angeles High Scalability Group
Cassandra 0.7, Los Angeles High Scalability GroupCassandra 0.7, Los Angeles High Scalability Group
Cassandra 0.7, Los Angeles High Scalability Group
 
Odnoklassniki.ru Architecture
Odnoklassniki.ru ArchitectureOdnoklassniki.ru Architecture
Odnoklassniki.ru Architecture
 
Databases for Storage Engineers
Databases for Storage EngineersDatabases for Storage Engineers
Databases for Storage Engineers
 
Big Bad PostgreSQL: BI on a Budget
Big Bad PostgreSQL: BI on a BudgetBig Bad PostgreSQL: BI on a Budget
Big Bad PostgreSQL: BI on a Budget
 
Hadoop: A Hands-on Introduction
Hadoop: A Hands-on IntroductionHadoop: A Hands-on Introduction
Hadoop: A Hands-on Introduction
 
Mathias test
Mathias testMathias test
Mathias test
 
Yet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRepYet Another Replication Tool: RubyRep
Yet Another Replication Tool: RubyRep
 
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume LaforgeGaelyk - SpringOne2GX - 2010 - Guillaume Laforge
Gaelyk - SpringOne2GX - 2010 - Guillaume Laforge
 
Riak and Ruby
Riak and RubyRiak and Ruby
Riak and Ruby
 
Seattle hug 2010
Seattle hug 2010Seattle hug 2010
Seattle hug 2010
 

HBase Deep Dive

  • 1. HBase Amandeep Khurana University of California, Santa Cruz Twitter: @amansk amansk@gmail.com www.amandeepkhurana.com Tuesday, August 17, 2010
  • 2. How did it start? • At Google • Lots of semi structured data • Commodity hardware • Horizontal scalability • Tight integration with MapReduce 2 Tuesday, August 17, 2010
  • 3. Why NoSQL? • RDBMS don’t scale • Typically large monolithic systems • Hard to shard • Specialized hardware.. expensive! • Buzzword! 3 Tuesday, August 17, 2010
  • 4. Google BigTable • Distributed multi level map • Fault tolerant, persistent • Scalable • Runs on commodity hardware • Self managing • Large number of read/write ops • Fast scans 4 Tuesday, August 17, 2010
  • 5. HBase • Open source BigTable • HDFS as underlying DFS • ZooKeeper as lock service • Tight integration with Hadoop MapReduce 5 Tuesday, August 17, 2010
  • 6. HBase • Data model • Architecture, implementation • Regions, Region Servers etc • API • Current status and future direction • Use cases • How to think HBase (or NoSQL)? 6 Tuesday, August 17, 2010
  • 7. Data Model • Sparse, multi dimensional map (row, column, timestamp) cell • Column = Column Family:Column Qualifier Columns Fam1:Qual1 Rows t1 AK v1 Timestamps 7 Tuesday, August 17, 2010
  • 8. Data Model • Sparse, multi dimensional map (row, column, timestamp) cell • Column = Column Family:Column Qualifier Columns Fam1:Qual1 Rows t1 AK v1 t2 v2 Timestamps t2>t1 7 Tuesday, August 17, 2010
  • 9. Regions • Region: Contiguous set of lexicographically sorted rows • hbase.hregion.max.filesize (default 256MB) • Regions hosted by Region Servers 8 Tuesday, August 17, 2010
  • 10. Regions and Splitting row1 row256 row257 row600 9 Tuesday, August 17, 2010
  • 11. Regions and Splitting row1 row256 row257 row600 Writes 9 Tuesday, August 17, 2010
  • 12. Regions and Splitting row1 row256 row257 row400 row401 row600 9 Tuesday, August 17, 2010
  • 13. System Structure M a p Region Servers Master R e d u c e HDFS ZooKeeper 10 Tuesday, August 17, 2010
  • 14. Master • Region splitting • Load balancing • Metadata operations • Multiple masters for failover 11 Tuesday, August 17, 2010
  • 15. ZooKeeper • Master election • Locate -ROOT- region • Region Server membership 12 Tuesday, August 17, 2010
  • 16. Where is my row? • 3 level hierarchical lookup scheme MyTable .META. MyRow -ROOT- ZooKeeper 13 Tuesday, August 17, 2010
  • 17. Where is my row? • 3 level hierarchical lookup scheme MyTable .META. MyRow -ROOT- ZooKeeper 13 Tuesday, August 17, 2010
  • 18. Where is my row? • 3 level hierarchical lookup scheme MyTable .META. MyRow -ROOT- ZooKeeper Row per META region 13 Tuesday, August 17, 2010
  • 19. Where is my row? • 3 level hierarchical lookup scheme MyTable .META. MyRow -ROOT- ZooKeeper Row per META region Row per table region 13 Tuesday, August 17, 2010
  • 20. Where is my row? • 3 level hierarchical lookup scheme MyTable .META. MyRow -ROOT- ZooKeeper Row per META region Row per table region 13 Tuesday, August 17, 2010
  • 21. Region Memstore HLog (Append only WAL on HDFS) HFile HFile (on HDFS) (on HDFS) (Sequence File) (one per RS) Region HFile: Immutable sorted map (byte[] byte[]) (row, column, timestamp) cell value 14 Tuesday, August 17, 2010
  • 22. Region Write Memstore HLog (Append only WAL on HDFS) HFile HFile (on HDFS) (on HDFS) (Sequence File) (one per RS) Region HFile: Immutable sorted map (byte[] byte[]) (row, column, timestamp) cell value 14 Tuesday, August 17, 2010
  • 23. Region Memstore HLog (Append only WAL on HDFS) HFile HFile (on HDFS) (on HDFS) (Sequence File) (one per RS) Region HFile: Immutable sorted map (byte[] byte[]) (row, column, timestamp) cell value 14 Tuesday, August 17, 2010
  • 24. Region Memstore Flush HLog (Append only Small WAL on HDFS) HFile HFile (Sequence File) (on HDFS) (on HDFS) HFile (one per RS) Region HFile: Immutable sorted map (byte[] byte[]) (row, column, timestamp) cell value 14 Tuesday, August 17, 2010
  • 25. Region Memstore HLog (Append only Small WAL on HDFS) HFile HFile (Sequence File) (on HDFS) (on HDFS) HFile (one per RS) Region HFile: Immutable sorted map (byte[] byte[]) (row, column, timestamp) cell value 14 Tuesday, August 17, 2010
  • 26. Region Memstore HLog (Append only Small WAL on HDFS) HFile HFile (Sequence File) (on HDFS) (on HDFS) HFile (one per RS) Compaction Region HFile: Immutable sorted map (byte[] byte[]) (row, column, timestamp) cell value 14 Tuesday, August 17, 2010
  • 27. Region Memstore HLog (Append only WAL on HDFS) (Sequence File) (one per RS) Compaction Region HFile: Immutable sorted map (byte[] byte[]) (row, column, timestamp) cell value 14 Tuesday, August 17, 2010
  • 28. Region Memstore HLog (Append only WAL on HDFS) HFile (on HDFS) (Sequence File) (one per RS) Region HFile: Immutable sorted map (byte[] byte[]) (row, column, timestamp) cell value 14 Tuesday, August 17, 2010
  • 29. Region Memstore HLog (Append only WAL on HDFS) HFile HFile HFile (on HDFS) (on HDFS) (on HDFS) (Sequence File) (one per RS) Region 15 Tuesday, August 17, 2010
  • 30. Region Read Memstore HLog (Append only WAL on HDFS) HFile HFile HFile (on HDFS) (on HDFS) (on HDFS) (Sequence File) (one per RS) Region 15 Tuesday, August 17, 2010
  • 31. Ways to access • Java • REST • Thrift • Scala • Jython • Groovy DSL • Ruby shell • Java MR, Cascading, Pig, Hive 16 Tuesday, August 17, 2010
  • 32. Java API • Get • Put • Delete • Scan • IncrementColumnValue • TableInputFormat - MapReduce Source • TableOutputFormat - MapReduce Sink 17 Tuesday, August 17, 2010
  • 33. Other Features • Compression • In memory column families • Multiple masters • Rolling restart • Bloom filters • Efficient bulk loads • Source and sink for Hive, Pig, Cascading 18 Tuesday, August 17, 2010
  • 34. Things being worked on • Master rewrite • Move more stuff into ZooKeeper • Column family based access control • Inter cluster replication (managed by ZK) • Store Lucene indexes (HBasene) 19 Tuesday, August 17, 2010
  • 36. HBase @ SU* • Backend for su.pr • Real time serving + MR analytics (separate clusters) • 50% cascading, 50% java MR • Prod cluster (~20 nodes) serves 20k requests/sec • All new features are backed by HBase • Hardware: 2xi7, 24GB RAM, 4x1TB *Source: Personal communication with 21 J-D Cryans, StumbleUpon Tuesday, August 17, 2010
  • 37. HBase @ Mozilla* • Socorro - crash reporting system • Catch, process and present crash info for Firefox, Thunderbird, Fennec, Camino, Seamonkey • 1.5m crash reports/day • Earlier: NFS, PostgreSQL • 17 node production cluster • Dual Quad Core + 24GB RAM + 4x1TB • Some user facing reports still served by PostgreSQL. Being ported to HBase in next Socorro version *Source: http://blog.mozilla.com/webdev/2010/07/26/ 22 moving-socorro-to-hbase/ Tuesday, August 17, 2010
  • 38. Data Integration* • Multiple heterogenous data sources • Notion of connected data • Think RDF • Graph connecting data elements across systems • Store in HBase, build transitive closures • Pattern mining *Source: ClouDFuse - Scalable data integration in the 23 cloud, MS Project, Amandeep Khurana, UC Santa Cruz Tuesday, August 17, 2010
  • 39. HBase @ Trend Micro* • Store threat information - Smart Protection Network • Open source cloud computing initiative - TCloud • Primarily run off EC2 *Source: https://hbase.s3.amazonaws.com/hbase/HBase- 24 Trend-HUG10.pdf Tuesday, August 17, 2010
  • 40. HBase @ Yahoo* • Content optimization • Meta-data about content stored in HBase • Used for extracting item features • Used in conjunction with PNUTS, Hadoop • Process 100s of GB in each run *Source: http://www.slideshare.net/ydn/7-online- 25 contentoptimizationhadoopsummit2010 Tuesday, August 17, 2010
  • 41. HBase @ Twitter* • 7TB/day incoming data, increasing • Analytics • People search • Building new solutions on HBase • Part of a much larger scheme of things • Scribe, Crane, Pig, MySQL, Cassandra, Oink, Elephant Bird, Birdbrain, Hadoop *Sources: http://www.slideshare.net/kevinweil/nosql-at- twitter-nosql-eu-2010 http://www.slideshare.net/ydn/3-hadoop- pigattwitterhadoopsummit2010 26 Tuesday, August 17, 2010
  • 42. Others • Facebook • Powerset • Flurry • WorldLingo • Adobe • Lily • Runa • Drawn To Scale • GumGum • RapLeaf • Openplaces • ... • Meetup.com 27 Tuesday, August 17, 2010
  • 43. How to think in HBase? Tuesday, August 17, 2010
  • 44. HBase v/s RDBMS • Neither solves all problems • It’s really a wrong comparison • But puts things in context 29 Tuesday, August 17, 2010
  • 45. HBase v/s RDBMS HBase RDBMS Column oriented Row oriented (mostly) Flexible schema, add columns on the Fixed schema fly Good with sparse tables Not optimized for sparse tables No query language SQL Wide tables Narrow tables Optimized for joins (small, fast ones Joins using MR - not optimized too!) Tight integration with MR Not really... 30 Tuesday, August 17, 2010
  • 46. HBase v/s RDBMS HBase RDBMS De-normalize your data Normalize as you can Horizontal scalability. Just add Hard to shard and scale hardware Consistent Consistent No transactions Transactional Good for semi structured data as well Good for structured data as structured data 31 Tuesday, August 17, 2010
  • 47. HBase v/s RDBMS 32 Tuesday, August 17, 2010
  • 48. HBase v/s RDBMS Rule:You probably don’t need HBase if your data can easily fit and be processed on a single RDBMS box. 32 Tuesday, August 17, 2010
  • 49. HBase v/s RDBMS Rule:You probably don’t need HBase if your data can easily fit and be processed on a single RDBMS box. But then, you are at Hadoop Day, so it probably can’t! 32 Tuesday, August 17, 2010