Big Data Day LA 2016/ Big Data Track - How To Use Impala and Kudu To Optimize Performance for Analytic Workloads, David Alves - Software Engineer - Cloudera
This session describes how Impala integrates with Kudu for analytic SQL queries on Hadoop and how this integration, taking full advantage of the distinct properties of Kudu, has significant performance benefits.
Similar to Big Data Day LA 2016/ Big Data Track - How To Use Impala and Kudu To Optimize Performance for Analytic Workloads, David Alves - Software Engineer - Cloudera
Building a High Performance Analytics PlatformSantanu Dey
Similar to Big Data Day LA 2016/ Big Data Track - How To Use Impala and Kudu To Optimize Performance for Analytic Workloads, David Alves - Software Engineer - Cloudera (20)
Big Data Day LA 2016/ Big Data Track - How To Use Impala and Kudu To Optimize Performance for Analytic Workloads, David Alves - Software Engineer - Cloudera
1. How to use Impala &
Kudu to optimize
performance for
Analytic Workloads
David Alves| david.alves@cloudera.com
2. ‹#›‹#›
Impala: A Modern, Open-Source SQL Engine
• Implementation of an MPP SQL query engine for the Hadoop environment
• Designed for performance: brand-new engine, written in C++
• Maintains Hadoop flexibility by utilizing standard Hadoop components
(HDFS, Kudu, HBase, MetaStore, Yarn)
• Plays well with traditional BI tools:
exposes/interacts with industry-standard interfaces (odbc/jdbc, Kerberos and
LDAP, ANSI SQL)
3. ‹#›‹#›
Kudu
Storage for Fast Analytics on Fast Data
• New updatable column store for
Hadoop
• Currently incubating as an
Apache project
• Beta now available
(kudu.apache.org)Columnar Store
Kudu
5. ‹#›‹#›
Impala Architecture: Distributed System
• Daemon process (impalad) runs on every node with data
• Each node handles user requests
• Load balancer configuration for multi-user environments recommended
• Metadata management: catalog service (single node)
• System state repository and distribution: statestore (single node)
• Catalog service and statestore are stateless
6. ‹#›‹#›
Impala Query Execution
• Query execution phases:
• client requests arrive via odbc/jdbc
• query planner turns request into collection of plan fragments
• coordinator initiates execution on remote impala’s
• During execution:
• intermediate results are streamed between query executors
• query results are streamed back to client
• subject to limitation imposed by blocking operators (top-n, aggregation,
sorting)
10. ‹#›‹#›
Query Planning: Overview
• Two-phase planning process
• single-node plan: tree of plan operators
• partitioning of operator tree into plan fragments for parallel execution
• Parallelization of operators across nodes
• all query operators are fully distributed
• Cost-based join order optimization
• Cost-based join distribution optimization
11. ‹#›‹#›
Impala Execution Engine
• Written in C++ for minimal cycle and memory overhead
• Leverages existing parallel DB research
• data-partitioned parallelism
• pipelined relational operators
• batch-at-a-time runtime
• Focussed on speed and efficiency
• intrinsics/machine code for text parsing, hashing, etc.
• runtime code generation with llvm
13. ‹#›‹#›
• High throughput for big scans (columnar
storage and replication)
Goal: Within 2x of Parquet
• Low-latency for short accesses (primary
key indexes and quorum replication)
Goal: 1ms read/write on SSD
• Database-like semantics (initially single-
row ACID)
• Relational data model
• SQL query
• “NoSQL” style scan/insert/update (Java client)
Kudu Design Goals
15. ‹#›‹#›
Kudu Usage
• Table has a SQL-like schema
• Finite number of columns (unlike HBase/Cassandra)
• Types: BOOL, INT8, INT16, INT32, INT64, FLOAT, DOUBLE, STRING,
BINARY, TIMESTAMP
• Some subset of columns makes up a possibly-composite primary key
• Fast ALTER TABLE
• Java and C++ “NoSQL” style APIs
• Insert(), Update(), Delete(), Scan()
• Integrations with Impala, Spark, MapReduce
• more to come!
15
16. ‹#›‹#›
Kudu Use Cases
Kudu is best for use cases requiring a simultaneous combination
of sequential and random reads and writes
● Time Series
○ Examples: Stream market data; fraud detection & prevention; risk
monitoring
○ Workload: Insert, updates, scans, lookups
● Machine Data Analytics
○ Examples: Network threat detection
○ Workload: Inserts, scans, lookups
● Online Reporting
○ Examples: ODS
○ Workload: Inserts, updates, scans, lookups
17. ‹#›‹#›
Real-Time Analytics in Hadoop Today
Fraud Detection in the Real World = Storage Complexity
Considerations:
● How do I handle failure
during this process?
● How often do I reorganize
data streaming in into a
format appropriate for
reporting?
● When reporting, how do I see
data that has not yet been
reorganized?
● How do I ensure that
important jobs aren’t
interrupted by maintenance?
New Partition
Most Recent Partition
Historic Data
HBase
Parquet
File
Have we
accumulated
enough data?
Reorganize
HBase file
into Parquet
• Wait for running operations to complete
• Define new Impala partition referencing
the newly written Parquet file
Incoming Data
(Messaging
System)
Reporting
Request
Impala on HDFS
19. ‹#›‹#›
Tables and Tablets
• Table is horizontally partitioned into tablets
• Range or hash partitioning
• Each tablet has N replicas (3 or 5), with Raft consensus
• Allow read from any replica, plus leader-driven writes with low MTTR
• Tablet servers host tablets
• Store data on local disks (no HDFS)
19
21. ‹#›‹#›
Tablet design
• Inserts buffered in an in-memory store (like HBase’s memstore)
• Flushed to disk
• Columnar layout, similar to Apache Parquet
• Updates use MVCC (updates tagged with timestamp, not in-place)
• Allow “SELECT AS OF <timestamp>” queries and consistent cross-
tablet scans
• Near-optimal read path for “current time” scans
• No per row branches, fast vectorized decoding and predicate evaluation
• Performance worsens based on number of recent updates
21
23. ‹#›‹#›
Impala + Kudu Architecture
Impalad
Kudu
Tablet
Server
Impal
ad
…
Statestore
Catalog
Service
Hive
Metastore
Hadoop
Namenode
Impalad
Kudu
Tablet
Server
Impalad
Kudu
Tablet
Server
Kudu
Master
24. ‹#›‹#›
Impala & Kudu integration – User features
• Table Create/Delete
• Advanced partitioning schemes
• Easily load/store data to/from kudu:
– “Create table kudu_table as select * from hdfs_table”
– ”Insert into hdfs_table select * from kudu_table AS PARQUET”
25. ‹#›‹#›
Impala & Kudu integration – User features
• Table Create/Delete
• Advanced partitioning schemes
• Easily load/store data to/from kudu:
– “Create table kudu_table as select * from hdfs_table”
– ”Insert into hdfs_table select * from kudu_table AS PARQUET”
26. ‹#›‹#›
Impala & Kudu integration - Partitioning
• Range partitioning
– PRIMARY KEY (host, metric, timestamp) DISTRIBUTE
BY HASH(timestamp) INTO 100 BUCKETS
• Hash partitioning
– PRIMARY KEY (last_name, first_name)DISTRIBUTE BY
RANGE (last_name, first_name)
• Range + Hash partitioning
– PRIMARY KEY (last_name, first_name)DISTRIBUTE BY
RANGE (last_name, first_name) INTO 100 BUCKETS
27. ‹#›‹#›
Impala & Kudu integration – Runtime Features
• Optimized data layout
• Predicate pushdown
• Data locality
• Tolerance to Kudu faults
28. ‹#›‹#›
Impala & Kudu integration – Roadmap
• Shared memory between impala and Kudu
• Scan Tokens – Forward encoded partitioning information to the Kudu client
• Timetravel scans
• Memory layout matching
• More predicate pushdown (like bloomfilters).
30. ‹#›‹#›
TPC-H (Analytics benchmark)
• 75TS + 1 master cluster
• 12 (spinning) disk each, enough RAM to fit dataset
• Using Kudu 0.5.0, Impala 2.2 with Kudu support, CDH 5.4
• TPC-H Scale Factor 100 (100GB)
• Example query:
• SELECT n_name, sum(l_extendedprice * (1 - l_discount)) as revenue FROM customer,
orders, lineitem, supplier, nation, region WHERE c_custkey = o_custkey AND
l_orderkey = o_orderkey AND l_suppkey = s_suppkey AND c_nationkey = s_nationkey
AND s_nationkey = n_nationkey AND n_regionkey = r_regionkey AND r_name = 'ASIA'
AND o_orderdate >= date '1994-01-01' AND o_orderdate < '1995-01-01’ GROUP BY
n_name ORDER BY revenue desc;
30