SlideShare a Scribd company logo
Apache Hive and Stinger:
SQL in Hadoop
Arun Murthy (@acmurthy)
Alan Gates (@alanfgates)
Owen O’Malley (@owen_omalley)
@hortonworks

© Hortonworks Inc. 2013.
YARN: Taking Hadoop Beyond Batch
Store ALL DATA in one place…
Interact with that data in MULTIPLE WAYS

with Predictable Performance and Quality of Service
Applica'ons	
  Run	
  Na'vely	
  IN	
  Hadoop	
  
BATCH	
  
INTERACTIVE	
  
(MapReduce)	
  
(Tez)	
  

ONLINE	
  
(HBase)	
  

STREAMING	
  
(Storm,	
  S4,…)	
  

GRAPH	
  
(Giraph)	
  

IN-­‐MEMORY	
  
(Spark)	
  

HPC	
  MPI	
  
(OpenMPI)	
  

OTHER	
  
(Search)	
  
(Weave…)	
  

YARN	
  (Cluster	
  Resource	
  Management)	
  	
  	
  
HDFS2	
  (Redundant,	
  Reliable	
  Storage)	
  

© Hortonworks Inc. 2013.

Page 2
Hadoop Beyond Batch with YARN
A shift from the old to the new…
Single Use System

Multi Use Data Platform

Batch Apps

Batch, Interactive, Online, Streaming, …

HADOOP 1

HADOOP 2
MapReduce	
  
(batch)	
  

MapReduce	
  

Tez	
  

(interac:ve)	
  

YARN	
  

Others	
  
(varied)	
  

(cluster	
  resource	
  management	
  
	
  &	
  data	
  processing)	
  

(opera:ng	
  system:	
  cluster	
  resource	
  management)	
  

HDFS	
  

HDFS2	
  

(redundant,	
  reliable	
  storage)	
  

© Hortonworks Inc. 2013.

(redundant,	
  reliable	
  storage)	
  
Apache Tez (“Speed”)
•  Replaces MapReduce as primitive for Pig, Hive, Cascading etc.
– Smaller latency for interactive queries
– Higher throughput for batch queries
– 22 contributors: Hortonworks (13), Facebook, Twitter, Yahoo, Microsoft
Task with pluggable Input, Processor and Output

Input	
  

Processor	
  

Output	
  

Task	
  
Tez Task - <Input, Processor, Output>

YARN ApplicationMaster to run DAG of Tez Tasks
© Hortonworks Inc. 2013.
Tez: Building blocks for scalable data processing
Classical ‘Map’

HDFS	
  
Input	
  

Map	
  
Processor	
  

Classical ‘Reduce’

Sorted	
  
Output	
  

Shuffle	
  
Input	
  

Shuffle	
  
Input	
  

Reduce	
  
Processor	
  

Sorted	
  
Output	
  

Intermediate ‘Reduce’ for
Map-Reduce-Reduce
© Hortonworks Inc. 2013.

Reduce	
  
Processor	
  

HDFS	
  
Output	
  
Hive-on-MR vs. Hive-on-Tez
Tez avoids
unneeded writes to
HDFS

SELECT a.x, AVERAGE(b.y) AS avg
FROM a JOIN b ON (a.id = b.id) GROUP BY a
UNION SELECT x, AVERAGE(y) AS AVG
FROM c GROUP BY x
ORDER BY AVG;

Hive – MR
M

M

Hive – Tez

M

SELECT a.state

SELECT b.id
R

R

M

SELECT a.state,
c.itemId

M

M

M
R

M

SELECT b.id

R

M

HDFS

JOIN (a, c)
SELECT c.price

M

R

M
R

HDFS

R

JOIN (a, c)

R

HDFS

JOIN(a, b)
GROUP BY a.state
COUNT(*)
AVERAGE(c.price)

© Hortonworks Inc. 2013.

M

M

R

M

JOIN(a, b)
GROUP BY a.state
COUNT(*)
AVERAGE(c.price)

R
Tez Sessions
… because Map/Reduce query startup is expensive
• Tez Sessions
– Hot containers ready for immediate use
– Removes task and job launch overhead (~5s – 30s)

• Hive
– Session launch/shutdown in background (seamless, user not
aware)
– Submits query plan directly to Tez Session

Native Hadoop service, not ad-hoc
© Hortonworks Inc. 2013.
Tez Delivers Interactive Query - Out of the Box!
Feature	
  

Descrip'on	
  

Benefit	
  

Tez	
  Session	
  

Overcomes	
  Map-­‐Reduce	
  job-­‐launch	
  latency	
  by	
  pre-­‐
launching	
  Tez	
  AppMaster	
  

Latency	
  

Tez	
  Container	
  Pre-­‐
Launch	
  

Overcomes	
  Map-­‐Reduce	
  latency	
  by	
  pre-­‐launching	
  
hot	
  containers	
  ready	
  to	
  serve	
  queries.	
  

Latency	
  

Finished	
  maps	
  and	
  reduces	
  pick	
  up	
  more	
  work	
  
Tez	
  Container	
  Re-­‐Use	
   rather	
  than	
  exi:ng.	
  Reduces	
  latency	
  and	
  eliminates	
  
difficult	
  split-­‐size	
  tuning.	
  Out	
  of	
  box	
  performance!	
  
Run:me	
  re-­‐
Run:me	
  query	
  tuning	
  by	
  picking	
  aggrega:on	
  
configura:on	
  of	
  DAG	
   parallelism	
  using	
  online	
  query	
  sta:s:cs	
  
Tez	
  In-­‐Memory	
  
Cache	
  

Hot	
  data	
  kept	
  in	
  RAM	
  for	
  fast	
  access.	
  

Complex	
  DAGs	
  

Tez	
  Broadcast	
  Edge	
  and	
  Map-­‐Reduce-­‐Reduce	
  
paXern	
  improve	
  query	
  scale	
  and	
  throughput.	
  

© Hortonworks Inc. 2013.

Latency	
  

Throughput	
  

Latency	
  
Throughput	
  
Page 8
Batch AND Interactive SQL-IN-Hadoop
Stinger Initiative

A broad, community-based effort to
drive the next generation of HIVE

S'nger	
  Project	
  

(announced	
  February	
  2013)	
  
Hive	
  0.11,	
  May	
  2013:	
  
•  Base	
  Op:miza:ons	
  
•  SQL	
  Analy:c	
  Func:ons	
  
•  ORCFile,	
  Modern	
  File	
  Format	
  

Goals:

Speed
Improve Hive query performance by 100X to
allow for interactive query times (seconds)

Hive	
  0.12,	
  October	
  2013:	
  
• 
• 
• 
• 

The only SQL interface to Hadoop designed
for queries that scale from TB to PB

SQL

	
  

© Hortonworks Inc. 2013.

Hive	
  on	
  Apache	
  Tez	
  
Query	
  Service	
  
Buffer	
  Cache	
  
Cost	
  Based	
  Op:mizer	
  (Op:q)	
  
Vectorized	
  Processing	
  

	
  
	
  
Coming	
  Soon:	
  

Support broadest range of SQL semantics for
analytic applications running against Hadoop

…all IN Hadoop

VARCHAR,	
  DATE	
  Types	
  
ORCFile	
  predicate	
  pushdown	
  
Advanced	
  Op:miza:ons	
  
Performance	
  Boosts	
  via	
  YARN	
  

• 
• 
• 
• 
• 

Scale
Hive 0.12
Hive 0.12
Release Theme

Speed, Scale and SQL

Specific Features

•  10x faster query launch when using large number
(500+) of partitions
•  ORCFile predicate pushdown speeds queries
•  Evaluate LIMIT on the map side
•  Parallel ORDER BY
•  New query optimizer
•  Introduces VARCHAR and DATE datatypes
•  GROUP BY on structs or unions

Included
Components

Apache Hive 0.12

© Hortonworks Inc. 2013.
SPEED: Increasing Hive Performance
Interactive Query Times across ALL use cases
•  Simple and advanced queries in seconds
•  Integrates seamlessly with existing tools
•  Currently a >100x improvement in just nine months
Performance Improvements
included in Hive 12
–  Base & advanced query optimization
–  Startup time improvement
–  Join optimizations

© Hortonworks Inc. 2013.
Stinger Phase 3: Interactive Query In Hadoop
Query	
  27:	
  Pricing	
  Analy'cs	
  using	
  Star	
  Schema	
  Join	
  	
  
Query	
  82:	
  Inventory	
  Analy'cs	
  Joining	
  2	
  Large	
  Fact	
  Tables	
  
1400s

190x	
  
Improvement	
  

3200s

200x	
  
Improvement	
  

65s
39s
14.9s

7.2s
TPC-­‐DS	
  Query	
  27	
  

Hive 10

Hive 0.11 (Phase 1)

TPC-­‐DS	
  Query	
  82	
  

Trunk (Phase 3)

All	
  Results	
  at	
  Scale	
  Factor	
  200	
  (Approximately	
  200GB	
  Data)	
  
© Hortonworks Inc. 2013.

Page 12
Speed: Delivering Interactive Query
Query	
  Time	
  in	
  Seconds	
  

Query	
  52:	
  Star	
  Schema	
  Join	
  	
  
Query	
  5:	
  Star	
  Schema	
  Join	
  

41.1s

39.8s

4.2s
TPC-­‐DS	
  Query	
  52	
  
Hive 0.12

Trunk (Phase 3)
© Hortonworks Inc. 2013.

4.1s
TPC-­‐DS	
  Query	
  55	
  
Test	
  Cluster:	
  
•  200	
  GB	
  Data	
  (Impala:	
  Parquet	
  	
  Hive:	
  ORCFile)	
  
•  20	
  Nodes,	
  24GB	
  RAM	
  each,	
  6x	
  disk	
  each	
  	
  
Speed: Delivering Interactive Query
Query	
  Time	
  in	
  Seconds	
  

Query	
  28:	
  Vectoriza'on	
  
Query	
  12:	
  Complex	
  join	
  (M-­‐R-­‐R	
  pabern)	
  

31s
22s

9.8s
TPC-­‐DS	
  Query	
  28	
  
Hive 0.12

Trunk (Phase 3)
© Hortonworks Inc. 2013.

6.7s
TPC-­‐DS	
  Query	
  12	
  
Test	
  Cluster:	
  
•  200	
  GB	
  Data	
  (Impala:	
  Parquet	
  	
  Hive:	
  ORCFile)	
  
•  20	
  Nodes,	
  24GB	
  RAM	
  each,	
  6x	
  disk	
  each	
  	
  
AMPLab Big Data Benchmark
AMPLab	
  Query	
  1:	
  Simple	
  Filter	
  Query	
  
63s

63s

45s

1.6s

2.3s

AMPLab	
  Query	
  1a	
  

AMPLab	
  Query	
  1b	
  

9.4s
AMPLab	
  Query	
  1c	
  
Query	
  Time	
  in	
  Seconds	
  
(lower	
  is	
  beXer)	
  

Hive 0.10 (5 node EC2)
Trunk (Phase 3)

© Hortonworks Inc. 2013.

S:nger	
  Phase	
  3	
  Cluster	
  Configura:on:	
  
•  AMPLab	
  Data	
  Set	
  (~135	
  GB	
  Data)	
  
•  20	
  Nodes,	
  24GB	
  RAM	
  each,	
  6x	
  Disk	
  each	
  	
  
Page 15
AMPLab Big Data Benchmark
AMPLab	
  Query	
  2:	
  Group	
  By	
  IP	
  Block	
  and	
  Aggregate	
  
552s
466s

104.3s
AMPLab	
  Query	
  2a	
  

490s

118.3s
AMPLab	
  Query	
  2b	
  

172.7s
AMPLab	
  Query	
  2c	
  
Query	
  Time	
  in	
  Seconds	
  
(lower	
  is	
  beXer)	
  

Hive 0.10 (5 node EC2)
Trunk (Phase 3)

© Hortonworks Inc. 2013.

S:nger	
  Phase	
  3	
  Cluster	
  Configura:on:	
  
•  AMPLab	
  Data	
  Set	
  (~135	
  GB	
  Data)	
  
•  20	
  Nodes,	
  24GB	
  RAM	
  each,	
  6x	
  Disk	
  each	
  	
  
Page 16
AMPLab Big Data Benchmark
AMPLab	
  Query	
  3:	
  Correlate	
  Page	
  Rankings	
  and	
  Revenues	
  Across	
  Time	
  
490s

466s

40s
AMPLab	
  Query	
  3a	
  

145s
AMPLab	
  Query	
  3b	
  
Query	
  Time	
  in	
  Seconds	
  
(lower	
  is	
  beXer)	
  

Hive 0.10 (5 node EC2)
Trunk (Phase 3)

© Hortonworks Inc. 2013.

S:nger	
  Phase	
  3	
  Cluster	
  Configura:on:	
  
•  AMPLab	
  Data	
  Set	
  (~135	
  GB	
  Data)	
  
•  20	
  Nodes,	
  24GB	
  RAM	
  each,	
  6x	
  Disk	
  each	
  	
  
Page 17
How Stinger Phase 3 Delivers Interactive Query

Feature	
  
Tez	
  Integra:on	
  

Descrip'on	
  
Tez	
  is	
  significantly	
  beXer	
  engine	
  than	
  MapReduce	
  

Benefit	
  
Latency	
  

Vectorized	
  Query	
  

Take	
  advantage	
  of	
  modern	
  hardware	
  by	
  processing	
  
thousand-­‐row	
  blocks	
  rather	
  than	
  row-­‐at-­‐a-­‐:me.	
  

Throughput	
  

Query	
  Planner	
  

Using	
  extensive	
  sta:s:cs	
  now	
  available	
  in	
  Metastore	
  
to	
  beXer	
  plan	
  and	
  op:mize	
  query,	
  including	
  
predicate	
  pushdown	
  during	
  compila:on	
  to	
  eliminate	
  
por:ons	
  of	
  input	
  (beyond	
  par::on	
  pruning)	
  

Latency	
  

Cost	
  Based	
  Op:mizer	
   Join	
  re-­‐ordering	
  and	
  other	
  op:miza:ons	
  based	
  on	
  
(Op:q)	
  
column	
  sta:s:cs	
  including	
  histograms	
  etc.	
  

© Hortonworks Inc. 2013.

Latency	
  

Page 18
SQL: Enhancing SQL Semantics
Hive	
  SQL	
  Datatypes	
  

Hive	
  SQL	
  Seman'cs	
  

SQL Compliance

INT	
  

SELECT,	
  INSERT	
  

TINYINT/SMALLINT/BIGINT	
  

GROUP	
  BY,	
  ORDER	
  BY,	
  SORT	
  BY	
  

BOOLEAN	
  

JOIN	
  on	
  explicit	
  join	
  key	
  

FLOAT	
  

Inner,	
  outer,	
  cross	
  and	
  semi	
  joins	
  

DOUBLE	
  

Sub-­‐queries	
  in	
  FROM	
  clause	
  

Hive 12 provides a wide
array of SQL datatypes
and semantics so your
existing tools integrate
more seamlessly with
Hadoop

STRING	
  

ROLLUP	
  and	
  CUBE	
  

TIMESTAMP	
  

UNION	
  

BINARY	
  

Windowing	
  Func:ons	
  (OVER,	
  RANK,	
  etc)	
  

DECIMAL	
  

Custom	
  Java	
  UDFs	
  

ARRAY,	
  MAP,	
  STRUCT,	
  UNION	
  

Standard	
  Aggrega:on	
  (SUM,	
  AVG,	
  etc.)	
  

DATE	
  

Advanced	
  UDFs	
  (ngram,	
  Xpath,	
  URL)	
  	
  

VARCHAR	
  

Sub-­‐queries	
  in	
  WHERE,	
  HAVING	
  

CHAR	
  

Expanded	
  JOIN	
  Syntax	
  
SQL	
  Compliant	
  Security	
  (GRANT,	
  etc.)	
  
INSERT/UPDATE/DELETE	
  (ACID)	
  
© Hortonworks Inc. 2013.

Available	
  
Hive	
  0.12	
  
Roadmap	
  
ORC File Format
• Columnar format for complex data types
• Built into Hive from 0.11
• Support for Pig and MapReduce via HCat
• Two levels of compression
– Lightweight type-specific and generic

• Built in indexes
– Every 10,000 rows with position information
– Min, Max, Sum, Count of each column
– Supports seek to row number

© Hortonworks Inc. 2013.

Page 20
SCALE: Interactive Query at Petabyte Scale
Sustained Query Times

Smaller Footprint

Apache Hive 0.12 provides
sustained acceptable query
times even at petabyte scale

Better encoding with ORC in
Apache Hive 0.12 reduces resource
requirements for your cluster

File	
  Size	
  Comparison	
  Across	
  Encoding	
  Methods	
  
Dataset:	
  TPC-­‐DS	
  Scale	
  500	
  Dataset	
  

585	
  GB	
  
(Original	
  Size)	
  

505	
  GB	
  
(14%	
  Smaller)	
  

Impala	
  

221	
  GB	
  

(62%	
  Smaller)	
  

Hive	
  12	
  

131	
  GB	
  

(78%	
  Smaller)	
  

Encoded	
  with	
  

Text	
  

© Hortonworks Inc. 2013.

Encoded	
  with	
  

RCFile	
  

Encoded	
  with	
  

Parquet	
  

Encoded	
  with	
  

ORCFile	
  

•  Larger Block Sizes
•  Columnar format
arranges columns
adjacent within the
file for compression
& fast access
ORC File Format
• Hive 0.12
– Predicate Push Down
– Improved run length encoding
– Adaptive string dictionaries
– Padding stripes to HDFS block boundaries

• Trunk
– Stripe-based Input Splits
– Input Split elimination
– Vectorized Reader
– Customized Pig Load and Store functions

© Hortonworks Inc. 2013.

Page 22
Vectorized Query Execution
• Designed for Modern Processor Architectures
– Avoid branching in the inner loop.
– Make the most use of L1 and L2 cache.

• How It Works
– Process records in batches of 1,000 rows
– Generate code from templates to minimize branching.

• What It Gives
– 30x improvement in rows processed per second.
– Initial prototype: 100M rows/sec on laptop

© Hortonworks Inc. 2013.

Page 23
HDFS Buffer Cache
• Use memory mapped buffers for zero copy
– Avoid overhead of going through DataNode
– Can mlock the block files into RAM

• ORC Reader enhanced for zero-copy reads
– New compression interfaces in Hadoop

• Vectorization specific reader
– Read 1000 rows at a time
– Read into Hive’s internal representation

© Hortonworks Inc. 2013.
Next Steps
• Blog
http://hortonworks.com/blog/delivering-on-stinger-a-phase-3-progress-update/

• Stinger Initiative
http://hortonworks.com/labs/stinger/

• Stinger Beta: HDP-2.1 Beta, December, 2013

© Hortonworks Inc. 2013.
Thank You!

@acmurthy
@alanfgates
@owen_omalley
@hortonworks
© Hortonworks Inc. 2013. Confidential and Proprietary.

More Related Content

PPTX
Achieving 100k Queries per Hour on Hive on Tez
PPTX
Hive analytic workloads hadoop summit san jose 2014
PDF
Sub-second-sql-on-hadoop-at-scale
PPTX
Evolving HDFS to a Generalized Distributed Storage Subsystem
PPTX
Evolving HDFS to Generalized Storage Subsystem
PDF
Query Engines for Hive: MR, Spark, Tez with LLAP – Considerations!
PPTX
Hive acid-updates-summit-sjc-2014
PPTX
Near Real-Time Network Anomaly Detection and Traffic Analysis using Spark bas...
Achieving 100k Queries per Hour on Hive on Tez
Hive analytic workloads hadoop summit san jose 2014
Sub-second-sql-on-hadoop-at-scale
Evolving HDFS to a Generalized Distributed Storage Subsystem
Evolving HDFS to Generalized Storage Subsystem
Query Engines for Hive: MR, Spark, Tez with LLAP – Considerations!
Hive acid-updates-summit-sjc-2014
Near Real-Time Network Anomaly Detection and Traffic Analysis using Spark bas...

What's hot (20)

PPTX
LLAP: Sub-Second Analytical Queries in Hive
PPTX
A Container-based Sizing Framework for Apache Hadoop/Spark Clusters
PDF
Large-Scale Stream Processing in the Hadoop Ecosystem
PPTX
Flexible and Real-Time Stream Processing with Apache Flink
PDF
Speed Up Your Queries with Hive LLAP Engine on Hadoop or in the Cloud
PPTX
An Apache Hive Based Data Warehouse
PPTX
De-Bugging Hive with Hadoop-in-the-Cloud
PPTX
Tune up Yarn and Hive
 
PDF
The Future of Apache Storm
PDF
ORC 2015: Faster, Better, Smaller
PPTX
What's new in Hadoop Common and HDFS
PPTX
Apache Phoenix and HBase: Past, Present and Future of SQL over HBase
PPTX
CBlocks - Posix compliant files systems for HDFS
PPTX
LLAP: Sub-Second Analytical Queries in Hive
PDF
Optimizing Hive Queries
PPTX
Apache Hive ACID Project
PDF
Optimizing Hive Queries
PDF
NYC HUG - Application Architectures with Apache Hadoop
PPTX
Apache Tez : Accelerating Hadoop Query Processing
PPTX
Streamline Hadoop DevOps with Apache Ambari
LLAP: Sub-Second Analytical Queries in Hive
A Container-based Sizing Framework for Apache Hadoop/Spark Clusters
Large-Scale Stream Processing in the Hadoop Ecosystem
Flexible and Real-Time Stream Processing with Apache Flink
Speed Up Your Queries with Hive LLAP Engine on Hadoop or in the Cloud
An Apache Hive Based Data Warehouse
De-Bugging Hive with Hadoop-in-the-Cloud
Tune up Yarn and Hive
 
The Future of Apache Storm
ORC 2015: Faster, Better, Smaller
What's new in Hadoop Common and HDFS
Apache Phoenix and HBase: Past, Present and Future of SQL over HBase
CBlocks - Posix compliant files systems for HDFS
LLAP: Sub-Second Analytical Queries in Hive
Optimizing Hive Queries
Apache Hive ACID Project
Optimizing Hive Queries
NYC HUG - Application Architectures with Apache Hadoop
Apache Tez : Accelerating Hadoop Query Processing
Streamline Hadoop DevOps with Apache Ambari
Ad

Viewers also liked (20)

PPTX
Hive2.0 sql speed-scale--hadoop-summit-dublin-apr-2016
PDF
Gunther hagleitner:apache hive & stinger
PDF
Hive on spark berlin buzzwords
PDF
TriHUG Feb: Hive on spark
PDF
Hive join optimizations
PPTX
Hive2.0 big dataspain-nov-2016
PPTX
Big data spain keynote nov 2016
PPTX
Hadoop, Hive, Spark and Object Stores
PPTX
Hive ACID Apache BigData 2016
PPTX
Hive & HBase for Transaction Processing Hadoop Summit EU Apr 2015
PPTX
Keynote apache bd-eu-nov-2016
PPTX
Hortonworks apache training
PDF
Gluent New World #02 - SQL-on-Hadoop : A bit of History, Current State-of-the...
PPTX
Hive acid-updates-strata-sjc-feb-2015
PPTX
Empower Hive with Spark
PPTX
Achieving Real-time Ingestion and Analysis of Security Events through Kafka a...
PPTX
Hive on spark is blazing fast or is it final
PDF
Architecting a Next Generation Data Platform
PPTX
La investigación cualitativa
PDF
Strata San Jose 2017 - Ben Sharma Presentation
Hive2.0 sql speed-scale--hadoop-summit-dublin-apr-2016
Gunther hagleitner:apache hive & stinger
Hive on spark berlin buzzwords
TriHUG Feb: Hive on spark
Hive join optimizations
Hive2.0 big dataspain-nov-2016
Big data spain keynote nov 2016
Hadoop, Hive, Spark and Object Stores
Hive ACID Apache BigData 2016
Hive & HBase for Transaction Processing Hadoop Summit EU Apr 2015
Keynote apache bd-eu-nov-2016
Hortonworks apache training
Gluent New World #02 - SQL-on-Hadoop : A bit of History, Current State-of-the...
Hive acid-updates-strata-sjc-feb-2015
Empower Hive with Spark
Achieving Real-time Ingestion and Analysis of Security Events through Kafka a...
Hive on spark is blazing fast or is it final
Architecting a Next Generation Data Platform
La investigación cualitativa
Strata San Jose 2017 - Ben Sharma Presentation
Ad

Similar to Strata Stinger Talk October 2013 (20)

PDF
Overview of stinger interactive query for hive
PPTX
An In-Depth Look at Putting the Sting in Hive
PPTX
Stinger hadoop summit june 2013
PPTX
Hive for Analytic Workloads
PPTX
La big datacamp2014_vikram_dixit
PPTX
February 2014 HUG : Hive On Tez
PPTX
Stinger Initiative: Leveraging Hive & Yarn for High-Performance/Interactive Q...
PPTX
Stinger Initiative - Deep Dive
PPTX
Stinger.Next by Alan Gates of Hortonworks
PDF
Overview of the Hive Stinger Initiative
PPTX
Hadoop Now, Next and Beyond
PPTX
Performance Hive+Tez 2
PPTX
Hive+Tez: A performance deep dive
PPTX
Hive + Tez: A Performance Deep Dive
PPTX
Using Apache Hive with High Performance
PPTX
Hive present-and-feature-shanghai
PDF
April 2013 HUG: The Stinger Initiative - Making Apache Hive 100 Times Faster
PPTX
Apache Hive 2.0: SQL, Speed, Scale
PPTX
Hortonworks.bdb
PPTX
Apache Hive 2.0: SQL, Speed, Scale
Overview of stinger interactive query for hive
An In-Depth Look at Putting the Sting in Hive
Stinger hadoop summit june 2013
Hive for Analytic Workloads
La big datacamp2014_vikram_dixit
February 2014 HUG : Hive On Tez
Stinger Initiative: Leveraging Hive & Yarn for High-Performance/Interactive Q...
Stinger Initiative - Deep Dive
Stinger.Next by Alan Gates of Hortonworks
Overview of the Hive Stinger Initiative
Hadoop Now, Next and Beyond
Performance Hive+Tez 2
Hive+Tez: A performance deep dive
Hive + Tez: A Performance Deep Dive
Using Apache Hive with High Performance
Hive present-and-feature-shanghai
April 2013 HUG: The Stinger Initiative - Making Apache Hive 100 Times Faster
Apache Hive 2.0: SQL, Speed, Scale
Hortonworks.bdb
Apache Hive 2.0: SQL, Speed, Scale

Recently uploaded (20)

PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Electronic commerce courselecture one. Pdf
PDF
KodekX | Application Modernization Development
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Machine learning based COVID-19 study performance prediction
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
NewMind AI Weekly Chronicles - August'25 Week I
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Big Data Technologies - Introduction.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Network Security Unit 5.pdf for BCA BBA.
Electronic commerce courselecture one. Pdf
KodekX | Application Modernization Development
Spectral efficient network and resource selection model in 5G networks
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Review of recent advances in non-invasive hemoglobin estimation
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Digital-Transformation-Roadmap-for-Companies.pptx
Empathic Computing: Creating Shared Understanding
Understanding_Digital_Forensics_Presentation.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Machine learning based COVID-19 study performance prediction
Per capita expenditure prediction using model stacking based on satellite ima...

Strata Stinger Talk October 2013

  • 1. Apache Hive and Stinger: SQL in Hadoop Arun Murthy (@acmurthy) Alan Gates (@alanfgates) Owen O’Malley (@owen_omalley) @hortonworks © Hortonworks Inc. 2013.
  • 2. YARN: Taking Hadoop Beyond Batch Store ALL DATA in one place… Interact with that data in MULTIPLE WAYS with Predictable Performance and Quality of Service Applica'ons  Run  Na'vely  IN  Hadoop   BATCH   INTERACTIVE   (MapReduce)   (Tez)   ONLINE   (HBase)   STREAMING   (Storm,  S4,…)   GRAPH   (Giraph)   IN-­‐MEMORY   (Spark)   HPC  MPI   (OpenMPI)   OTHER   (Search)   (Weave…)   YARN  (Cluster  Resource  Management)       HDFS2  (Redundant,  Reliable  Storage)   © Hortonworks Inc. 2013. Page 2
  • 3. Hadoop Beyond Batch with YARN A shift from the old to the new… Single Use System Multi Use Data Platform Batch Apps Batch, Interactive, Online, Streaming, … HADOOP 1 HADOOP 2 MapReduce   (batch)   MapReduce   Tez   (interac:ve)   YARN   Others   (varied)   (cluster  resource  management    &  data  processing)   (opera:ng  system:  cluster  resource  management)   HDFS   HDFS2   (redundant,  reliable  storage)   © Hortonworks Inc. 2013. (redundant,  reliable  storage)  
  • 4. Apache Tez (“Speed”) •  Replaces MapReduce as primitive for Pig, Hive, Cascading etc. – Smaller latency for interactive queries – Higher throughput for batch queries – 22 contributors: Hortonworks (13), Facebook, Twitter, Yahoo, Microsoft Task with pluggable Input, Processor and Output Input   Processor   Output   Task   Tez Task - <Input, Processor, Output> YARN ApplicationMaster to run DAG of Tez Tasks © Hortonworks Inc. 2013.
  • 5. Tez: Building blocks for scalable data processing Classical ‘Map’ HDFS   Input   Map   Processor   Classical ‘Reduce’ Sorted   Output   Shuffle   Input   Shuffle   Input   Reduce   Processor   Sorted   Output   Intermediate ‘Reduce’ for Map-Reduce-Reduce © Hortonworks Inc. 2013. Reduce   Processor   HDFS   Output  
  • 6. Hive-on-MR vs. Hive-on-Tez Tez avoids unneeded writes to HDFS SELECT a.x, AVERAGE(b.y) AS avg FROM a JOIN b ON (a.id = b.id) GROUP BY a UNION SELECT x, AVERAGE(y) AS AVG FROM c GROUP BY x ORDER BY AVG; Hive – MR M M Hive – Tez M SELECT a.state SELECT b.id R R M SELECT a.state, c.itemId M M M R M SELECT b.id R M HDFS JOIN (a, c) SELECT c.price M R M R HDFS R JOIN (a, c) R HDFS JOIN(a, b) GROUP BY a.state COUNT(*) AVERAGE(c.price) © Hortonworks Inc. 2013. M M R M JOIN(a, b) GROUP BY a.state COUNT(*) AVERAGE(c.price) R
  • 7. Tez Sessions … because Map/Reduce query startup is expensive • Tez Sessions – Hot containers ready for immediate use – Removes task and job launch overhead (~5s – 30s) • Hive – Session launch/shutdown in background (seamless, user not aware) – Submits query plan directly to Tez Session Native Hadoop service, not ad-hoc © Hortonworks Inc. 2013.
  • 8. Tez Delivers Interactive Query - Out of the Box! Feature   Descrip'on   Benefit   Tez  Session   Overcomes  Map-­‐Reduce  job-­‐launch  latency  by  pre-­‐ launching  Tez  AppMaster   Latency   Tez  Container  Pre-­‐ Launch   Overcomes  Map-­‐Reduce  latency  by  pre-­‐launching   hot  containers  ready  to  serve  queries.   Latency   Finished  maps  and  reduces  pick  up  more  work   Tez  Container  Re-­‐Use   rather  than  exi:ng.  Reduces  latency  and  eliminates   difficult  split-­‐size  tuning.  Out  of  box  performance!   Run:me  re-­‐ Run:me  query  tuning  by  picking  aggrega:on   configura:on  of  DAG   parallelism  using  online  query  sta:s:cs   Tez  In-­‐Memory   Cache   Hot  data  kept  in  RAM  for  fast  access.   Complex  DAGs   Tez  Broadcast  Edge  and  Map-­‐Reduce-­‐Reduce   paXern  improve  query  scale  and  throughput.   © Hortonworks Inc. 2013. Latency   Throughput   Latency   Throughput   Page 8
  • 9. Batch AND Interactive SQL-IN-Hadoop Stinger Initiative A broad, community-based effort to drive the next generation of HIVE S'nger  Project   (announced  February  2013)   Hive  0.11,  May  2013:   •  Base  Op:miza:ons   •  SQL  Analy:c  Func:ons   •  ORCFile,  Modern  File  Format   Goals: Speed Improve Hive query performance by 100X to allow for interactive query times (seconds) Hive  0.12,  October  2013:   •  •  •  •  The only SQL interface to Hadoop designed for queries that scale from TB to PB SQL   © Hortonworks Inc. 2013. Hive  on  Apache  Tez   Query  Service   Buffer  Cache   Cost  Based  Op:mizer  (Op:q)   Vectorized  Processing       Coming  Soon:   Support broadest range of SQL semantics for analytic applications running against Hadoop …all IN Hadoop VARCHAR,  DATE  Types   ORCFile  predicate  pushdown   Advanced  Op:miza:ons   Performance  Boosts  via  YARN   •  •  •  •  •  Scale
  • 10. Hive 0.12 Hive 0.12 Release Theme Speed, Scale and SQL Specific Features •  10x faster query launch when using large number (500+) of partitions •  ORCFile predicate pushdown speeds queries •  Evaluate LIMIT on the map side •  Parallel ORDER BY •  New query optimizer •  Introduces VARCHAR and DATE datatypes •  GROUP BY on structs or unions Included Components Apache Hive 0.12 © Hortonworks Inc. 2013.
  • 11. SPEED: Increasing Hive Performance Interactive Query Times across ALL use cases •  Simple and advanced queries in seconds •  Integrates seamlessly with existing tools •  Currently a >100x improvement in just nine months Performance Improvements included in Hive 12 –  Base & advanced query optimization –  Startup time improvement –  Join optimizations © Hortonworks Inc. 2013.
  • 12. Stinger Phase 3: Interactive Query In Hadoop Query  27:  Pricing  Analy'cs  using  Star  Schema  Join     Query  82:  Inventory  Analy'cs  Joining  2  Large  Fact  Tables   1400s 190x   Improvement   3200s 200x   Improvement   65s 39s 14.9s 7.2s TPC-­‐DS  Query  27   Hive 10 Hive 0.11 (Phase 1) TPC-­‐DS  Query  82   Trunk (Phase 3) All  Results  at  Scale  Factor  200  (Approximately  200GB  Data)   © Hortonworks Inc. 2013. Page 12
  • 13. Speed: Delivering Interactive Query Query  Time  in  Seconds   Query  52:  Star  Schema  Join     Query  5:  Star  Schema  Join   41.1s 39.8s 4.2s TPC-­‐DS  Query  52   Hive 0.12 Trunk (Phase 3) © Hortonworks Inc. 2013. 4.1s TPC-­‐DS  Query  55   Test  Cluster:   •  200  GB  Data  (Impala:  Parquet    Hive:  ORCFile)   •  20  Nodes,  24GB  RAM  each,  6x  disk  each    
  • 14. Speed: Delivering Interactive Query Query  Time  in  Seconds   Query  28:  Vectoriza'on   Query  12:  Complex  join  (M-­‐R-­‐R  pabern)   31s 22s 9.8s TPC-­‐DS  Query  28   Hive 0.12 Trunk (Phase 3) © Hortonworks Inc. 2013. 6.7s TPC-­‐DS  Query  12   Test  Cluster:   •  200  GB  Data  (Impala:  Parquet    Hive:  ORCFile)   •  20  Nodes,  24GB  RAM  each,  6x  disk  each    
  • 15. AMPLab Big Data Benchmark AMPLab  Query  1:  Simple  Filter  Query   63s 63s 45s 1.6s 2.3s AMPLab  Query  1a   AMPLab  Query  1b   9.4s AMPLab  Query  1c   Query  Time  in  Seconds   (lower  is  beXer)   Hive 0.10 (5 node EC2) Trunk (Phase 3) © Hortonworks Inc. 2013. S:nger  Phase  3  Cluster  Configura:on:   •  AMPLab  Data  Set  (~135  GB  Data)   •  20  Nodes,  24GB  RAM  each,  6x  Disk  each     Page 15
  • 16. AMPLab Big Data Benchmark AMPLab  Query  2:  Group  By  IP  Block  and  Aggregate   552s 466s 104.3s AMPLab  Query  2a   490s 118.3s AMPLab  Query  2b   172.7s AMPLab  Query  2c   Query  Time  in  Seconds   (lower  is  beXer)   Hive 0.10 (5 node EC2) Trunk (Phase 3) © Hortonworks Inc. 2013. S:nger  Phase  3  Cluster  Configura:on:   •  AMPLab  Data  Set  (~135  GB  Data)   •  20  Nodes,  24GB  RAM  each,  6x  Disk  each     Page 16
  • 17. AMPLab Big Data Benchmark AMPLab  Query  3:  Correlate  Page  Rankings  and  Revenues  Across  Time   490s 466s 40s AMPLab  Query  3a   145s AMPLab  Query  3b   Query  Time  in  Seconds   (lower  is  beXer)   Hive 0.10 (5 node EC2) Trunk (Phase 3) © Hortonworks Inc. 2013. S:nger  Phase  3  Cluster  Configura:on:   •  AMPLab  Data  Set  (~135  GB  Data)   •  20  Nodes,  24GB  RAM  each,  6x  Disk  each     Page 17
  • 18. How Stinger Phase 3 Delivers Interactive Query Feature   Tez  Integra:on   Descrip'on   Tez  is  significantly  beXer  engine  than  MapReduce   Benefit   Latency   Vectorized  Query   Take  advantage  of  modern  hardware  by  processing   thousand-­‐row  blocks  rather  than  row-­‐at-­‐a-­‐:me.   Throughput   Query  Planner   Using  extensive  sta:s:cs  now  available  in  Metastore   to  beXer  plan  and  op:mize  query,  including   predicate  pushdown  during  compila:on  to  eliminate   por:ons  of  input  (beyond  par::on  pruning)   Latency   Cost  Based  Op:mizer   Join  re-­‐ordering  and  other  op:miza:ons  based  on   (Op:q)   column  sta:s:cs  including  histograms  etc.   © Hortonworks Inc. 2013. Latency   Page 18
  • 19. SQL: Enhancing SQL Semantics Hive  SQL  Datatypes   Hive  SQL  Seman'cs   SQL Compliance INT   SELECT,  INSERT   TINYINT/SMALLINT/BIGINT   GROUP  BY,  ORDER  BY,  SORT  BY   BOOLEAN   JOIN  on  explicit  join  key   FLOAT   Inner,  outer,  cross  and  semi  joins   DOUBLE   Sub-­‐queries  in  FROM  clause   Hive 12 provides a wide array of SQL datatypes and semantics so your existing tools integrate more seamlessly with Hadoop STRING   ROLLUP  and  CUBE   TIMESTAMP   UNION   BINARY   Windowing  Func:ons  (OVER,  RANK,  etc)   DECIMAL   Custom  Java  UDFs   ARRAY,  MAP,  STRUCT,  UNION   Standard  Aggrega:on  (SUM,  AVG,  etc.)   DATE   Advanced  UDFs  (ngram,  Xpath,  URL)     VARCHAR   Sub-­‐queries  in  WHERE,  HAVING   CHAR   Expanded  JOIN  Syntax   SQL  Compliant  Security  (GRANT,  etc.)   INSERT/UPDATE/DELETE  (ACID)   © Hortonworks Inc. 2013. Available   Hive  0.12   Roadmap  
  • 20. ORC File Format • Columnar format for complex data types • Built into Hive from 0.11 • Support for Pig and MapReduce via HCat • Two levels of compression – Lightweight type-specific and generic • Built in indexes – Every 10,000 rows with position information – Min, Max, Sum, Count of each column – Supports seek to row number © Hortonworks Inc. 2013. Page 20
  • 21. SCALE: Interactive Query at Petabyte Scale Sustained Query Times Smaller Footprint Apache Hive 0.12 provides sustained acceptable query times even at petabyte scale Better encoding with ORC in Apache Hive 0.12 reduces resource requirements for your cluster File  Size  Comparison  Across  Encoding  Methods   Dataset:  TPC-­‐DS  Scale  500  Dataset   585  GB   (Original  Size)   505  GB   (14%  Smaller)   Impala   221  GB   (62%  Smaller)   Hive  12   131  GB   (78%  Smaller)   Encoded  with   Text   © Hortonworks Inc. 2013. Encoded  with   RCFile   Encoded  with   Parquet   Encoded  with   ORCFile   •  Larger Block Sizes •  Columnar format arranges columns adjacent within the file for compression & fast access
  • 22. ORC File Format • Hive 0.12 – Predicate Push Down – Improved run length encoding – Adaptive string dictionaries – Padding stripes to HDFS block boundaries • Trunk – Stripe-based Input Splits – Input Split elimination – Vectorized Reader – Customized Pig Load and Store functions © Hortonworks Inc. 2013. Page 22
  • 23. Vectorized Query Execution • Designed for Modern Processor Architectures – Avoid branching in the inner loop. – Make the most use of L1 and L2 cache. • How It Works – Process records in batches of 1,000 rows – Generate code from templates to minimize branching. • What It Gives – 30x improvement in rows processed per second. – Initial prototype: 100M rows/sec on laptop © Hortonworks Inc. 2013. Page 23
  • 24. HDFS Buffer Cache • Use memory mapped buffers for zero copy – Avoid overhead of going through DataNode – Can mlock the block files into RAM • ORC Reader enhanced for zero-copy reads – New compression interfaces in Hadoop • Vectorization specific reader – Read 1000 rows at a time – Read into Hive’s internal representation © Hortonworks Inc. 2013.

Editor's Notes

  • #14: query 52 star join followed by group/order (different keys), selective filterquery 55 same
  • #15: query 28: 4subquery joinquery 12: star join over range of dates
  • #16: query 1: SELECT pageURL, pageRank FROM rankings WHERE pageRank &gt; X
  • #17: SELECT SUBSTR(sourceIP, 1, X), SUM(adRevenue) FROM uservisits GROUP BYSUBSTR(sourceIP, 1, X)
  • #18: SELECT sourceIP, totalRevenue, avgPageRankFROM (SELECT sourceIP, AVG(pageRank) as avgPageRank, SUM(adRevenue) as totalRevenue FROM Rankings AS R, UserVisits AS UV WHERE R.pageURL = UV.destURL AND UV.visitDate BETWEEN Date(`1980-01-01&apos;) AND Date(`X&apos;) GROUP BY UV.sourceIP)ORDER BY totalRevenue DESC LIMIT 1
  • #20: With Hive and Stinger we are focused on enabling the SQL ecosystem and to do that we’ve put Hive on a clear roadmap to SQL compliance.That includes adding critical datatypes like character and date types as well as implementing common SQL semantics seen in most databases.