Post on 27-Jan-2015
description
transcript
1
Technology Preview: Not your father’s database system
Session Number 1971
Guy Lohman, PhD, IBMKeshava Murthy, IBM
2
© Copyright IBM Corporation 2010. All rights reserved.U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. IN ADDITION, THIS INFORMATION IS BASED ON IBM’S CURRENT PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM WITHOUT NOTICE. IBM SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION. NOTHING CONTAINED IN THIS PRESENTATION IS INTENDED TO, NOR SHALL HAVE THE EFFECT OF, CREATING ANY WARRANTIES OR REPRESENTATIONS FROM IBM (OR ITS SUPPLIERS OR LICENSORS), OR ALTERING THE TERMS AND CONDITIONS OF ANY AGREEMENT OR LICENSE GOVERNING THE USE OF IBM PRODUCTS AND/OR SOFTWARE.
IBM, the IBM logo, ibm.com, Informix, DB2 are trademarks or registered trademarks of International Business Machines Corporation in the United States, other countries, or both. If these and other IBM trademarked terms are marked on their first occurrence in this information with a trademark symbol (® or ™), these symbols indicate U.S. registered or common law trademarks owned by IBM at the time this information was published. Such trademarks may also be registered or common law trademarks in other countries. A current list of IBM trademarks is available on the Web at “Copyright and trademark information” at www.ibm.com/legal/copytrade.shtml
Other company, product, or service names may be trademarks or service marks of others.
Disclaimer
3
Disclaimers
• This talk is about proof of concept of a technology developed at IBM research labs.
• This is NOT a talk on IBM Informix product or planned release.
• Please read the previous disclaimer page carefully.
4
IBM Smart Analytics Optimizer (ISAO) – Agenda
• The Third Generation of Database Technology
• Why and What is the IBM Smart Analytics Optimizer?
• ISAO Market – Business Intelligence
• ISAO Architecture
• It’s All About Performance!
• From the User’s Perspective
• What’s the Big Deal?
• Behind the Curtain – The Query Engine Technology
• ISAO vs. Column Stores
• Conclusions
5
Third Generation of Database Technology (is here)
According to IDC’s Article (Carl Olofson) – Feb. 2010
1st Generation:
- Vendor proprietary databases of IMS, IDMS, Datacom
2nd Generation:
- RDBMS for Open Systems, dependent on disk layout, limitations in scalability and disk I/O
IDC Prediction that within 5 years:
• Most data warehouses will be stored in a columnar fashion
• Most OLTP database will either be augmented by an in-memory database (IMDB) or reside entirely in memory
• Most large-scale database servers will achieve horizontal scalability through clustering
6
Why Optimize Smart Analytics?
• Today, performance of Business Intelligence (BI) queries is too unpredictable
– When an analyst submits a query, s/he doesn’t know whether to:
– Response time depends upon “performance layer” of indexes & materializations
– Depends critically on predicting the workload
– But BI is inherently ad hoc!• Goal of IBM Smart Analytics Optimizer:
Predictably Fast (i.e., Interactive) Ad Hoc Querying
– Any query should run in about the same time
– Permit an Analyst to interact with the data
7
What Is the IBM Smart Analytics Optimizer?
• IBM Smart Analytics Optimizer for Informix Prototype is:
– Network-attached accelerator to Informix
– Exploits:
• Large main memories
• Commodity multi-core processors
• Extreme compression
– Speeds up typical Data Warehouse / Business Intelligence SQL queries by 10x to 100x
– Without requiring tuning of indexes, materialized views, etc.
8
What IBM Smart Analytics Optimizer is Designed For
• OLAP-style SQL queries:
– Relational star schema (large fact table joined to multiple dimensions)
– Large subset of data warehouse accessed, reduced significantly by...
– Aggregations (SUM, AVG, COUNT) and optional grouping (GROUP BY)
– Looking for trends or exceptions
• EXAMPLE SQL:
SELECT P.Manufacturer, S.Type, SUM(Revenue)FROM Fact_Sales F
INNER JOIN Dim_Product P ON F.FKP = P.PKINNER JOIN Dim_Store S ON F.FKS = S.PKLEFT OUTER JOIN Dim_Time T ON F.FKT = T.PK
WHERE P.Type = “JEANS“ AND S.Size > 50000 AND T.Year = 2007
GROUP BY P.Manufacturer, S.Type
9
IBM Smart Analytics Optimizer (ISAO) – Agenda
• The Third Generation of Database Technology
• Why and What is the IBM Smart Analytics Optimizer?
• ISAO Market – Business Intelligence
• ISAO Architecture
• It’s All About Performance!
• From the User’s Perspective
• What’s the Big Deal?
• Behind the Curtain – The Query Engine Technology
• ISAO vs. Column Stores
• Conclusions
10
TC
P/IP
IBM Smart Analytics Optimizer Configuration
Informix Prototype:• Routes SQL queries to accelerator
• User need not change SQL or apps.
• Can always run query in IDS, e.g., if
– too short an est. execution time
– Uses functions, datatypes unsupported in ISAO at this point.
Bulk Loader
SQL Queries (from apps)
IBM Smart Analytics Optimizer
Compressed DB partition
QueryProcessor
Data Warehouse
Informix SQL
(via DRDA)
Query Router
IBM Smart Analytics Optimizer: Multiple blades in blade center Connects to IDS via TCP/IP & DRDA Analyzes, compresses, and loads
Copy of (portion of) warehouse Partitioned among nodes
Processes routed SQL query and returns answer to Informix
Results
11
IBM Smart Analytics Optimizer Architecture
DS 5020 SAN
GPFS GPFS GPFS GPFS GPFS GPFS
8 Core48 GB
Coord.
8 Core48GB
Coord.
8 Core48GB
Worker
8 Core48GB
Worker
8 Core48GB
Worker
8 Core48GB
Worker
Blade Center - S
Flash Flash Flash Flash Flash Flash
FC Module
FC
...
Ethernet Module
IBM Smart Analytics Optimizer
Informix
. Accelerator
Services
DRDA
Informix Database
SQL Applications
12
IBM Smart Analytics Optimizer (ISAO) – Agenda
• The Third Generation of Database Technology
• Why and What is the IBM Smart Analytics Optimizer?
• ISAO Market – Business Intelligence
• ISAO Architecture
• It’s All About Performance!
• From the User’s Perspective
• What’s the Big Deal?
• Behind the Curtain – The Query Engine Technology
• ISAO vs. Column Stores
• Conclusions
13
4952
1
6538
88 65 1 6 41
5302
6
5677
14
6076
406
1 1
159
0
1000
2000
3000
4000
5000
6000
7000
Q1 Q2 Q3 Q4 Q6 Q7
Customer Query Number
Ex
ec
uti
on
Tim
e (
in S
ec
on
ds
)
0
50
100
150
200
250
300
350
400
450
Sp
ee
d-U
p R
ati
o =
Info
rmix
/ IS
AO
IBM Partner testing their customer warehouse.
ISAO Accelerates Most the Longest-Running Informix Queries
Average Speed-up = 116x
1 hour
14
Initial Profiling of a data mart at a government agency.
Performance expectation goals were up to 20X OLAP-style Queries
Tests were done on a 4 node Bladeserver S with Linux
Microstrategy Report was used, which generates 667 SQL statements
537 are SELECT statements. We can accelerate 432 through Informix Prototype & ISAO!
Datamart for this report has 250 Tables and 30 GB Data size
Informix Panther and ISAO run this report in 67 seconds.
7 seconds in ISAO and 60 seconds in Informix (TEMP table processing, etc)
Without ISAO, total runtime on Informix Panther on the same HW is 40 Minutes!
The same report today runs on XPS & SUN HW (Sparc M9000) and takes 90 mins.
Performance gain for the customer would be around 90x !!!
15
IBM Smart Analytics Optimizer (ISAO) – Agenda
• The Third Generation of Database Technology
• Why and What is the IBM Smart Analytics Optimizer?
• ISAO Market – Business Intelligence
• ISAO Architecture
• It’s All About Performance!
• From the User’s Perspective
• What’s the Big Deal?
• Behind the Curtain – The Query Engine Technology
• ISAO vs. Column Stores
• Conclusions
16
Getting Started: Loading Data into ISAO
A. DBA Defines Mart (Data to Accelerate)
– A mart is a logical collection of tables which are related to each other.
• For example, all tables of a single star schema would belong to the same mart.
– The administrator uses a rich client interface in Data Studio to define the tables that belong to a mart, together with information about their relationships.
B. Informix Automatically Copies Mart
– Informix creates definitions for these marts in its own catalog as a VIEW.
– The mart’s data is read from the Informix tables and transferred to ISAO.
C. ISAO Automatically Transforms & Loads Mart Data into a highly compressed, scan-optimized format that is kept locally (in memory) on ISAO
Define TransformInformix
17
InformixClient Application
Step 1. Submit SQL
Database protocol: SQLI or DRDA
Network protocol: TCP/IP or SHM
Step 2. Return results/describe/error
Database protocol: SQLI or DRDA
Network protocol: TCP/IP or SHM
Informix Warehouse -- Now
18
Informix
ISAO Appliance
2. Datamart Definition
IBM OptimData Studio
1. Identify the datamart to offload.
4. Create the metadata
5. Issue Off-load Datamart command
Datamart and Data off-loading from Informix to ISAO
3. Return the SQL representation
6. Off-load the data9. Return ACK
7. Distribute the data among blades
8. Compress the data
19
InformixClient Application
Step 1. Submit SQL
Database protocol: SQLI or DRDA
Network protocol: TCP/IP
Step 5. Return results/describe/error
Database protocol: SQLI or DRDA
Network protocol: TCP/IP
ISAO Appliance
Step 3
offload SQL.
DRDA over
tcp/ip
Step 4
Results
DRDA over
tcp/ip
Query Processing – with Informix and ISAO
2. IDS query matching and redirection technology
Local Execution
20
ISAO Supported Query Types
• IBM Smart Analytics Optimizer can process queries that contain:– Most built-in SQL functions– Most SQL data types– Only one query block (SELECT... FROM... WHERE... ) at a time
• Informix routes to ISAO each query block of a query • Queries including subquery predicates cannot be routed
– Only equi-joins (ON FACT.FK = DIM.PK)• Referencing columns with compatible types • SQL allows conversion without explicit cast• Expressions such as A.YEAR = YEAR(B.TIMESTAMP) not supported
– Only • Inner joins (explicit INNER JOIN or implicit join syntax), or• <Fact table> LEFT OUTER JOIN <Dimension table>
21
Supported Queries in Percent per Workload
Supported queries in percent (65 % on average)
31.82%
42.86%
60.00%
84.02%
0.00%
60.26%
98.24%93.75%
50.00%
76.67%83.90%
100.00%
0.00%
20.00%
40.00%
60.00%
80.00%
100.00%
120.00%
Supported percent
21,000 Queries from
Various Workloads
22
IBM Smart Analytics Optimizer (ISAO) – Agenda• The Third Generation of Database Technology
• Why and What is the IBM Smart Analytics Optimizer?
• ISAO Market – Business Intelligence
• ISAO Architecture
• It’s All About Performance!
• From the User’s Perspective
• What’s the Big Deal?
• The Query Engine Technology
• Behind the Curtain – The Query Engine Technology
• ISAO vs. Column Stores
• Conclusions
23
What’s the Big Deal? What’s so Disruptive?
• ISAO rides the wave of hardware technology trends:
– Multi-core processors
– Large main memories
– Fast interconnects
– Increasing latency gap between DRAM and disk
• ISAO disrupts at least 3 major tenets
that have been held sacrosanct for over 4 decades!
24
Disruption 1 of 3
• Tenet #1: Data warehouses are too big for memory
• Consequence of Tenet #1: Disk I/O concerns dominate DBMS…
– Costs
– Performance
– Administration efforts
• Disruption #1: Huge, cheap main memories (RAM) and flash memories / SSDs
• Consequences of Disruption #1:
– Portions of warehouse can fit, if partitioned among multiple machines
– Compression helps!
– Must be more conscious of cache & memory bandwidth utilization
– No preferred access path for reads
– Read only columns referenced (like column stores)
= 800 lbs.
25
Disruption 2 of 3• Tenet #2: Need many Indexes & MQTs for scalable OLAP performance• Consequences of Tenet #2:
– Need an optimizer to choose among access paths– Need a wizard to design “performance layer” (expensive!)– Must anticipate queries– Large time to update performance layer when new data added
• Disruption #2: Massive parallelism achieves database scan in seconds!
– Arbitrarily partition database among nodes (32–64 GB RAM / node)– On each node:
• Exploit multi-core architectures (1 user or DB cell / core)• Eliminate major portions of scan by partition & column group elimination
• Consequences of Disruption #2:
– Only need to define 1 AQT in Informix to satisfy many queries on the accelerator
– Always scan tables!!
– Accelerator automatically does equivalent of partition elimination• If literal is not in dictionary of that partition
– Accelerator itself doesn’t need • Performance layer (indexes or materialized views)!• Optimizer!
– Simpler! (no need for 4-star wizard)
– Lower TCO!
– Consistent response times
26
Disruption 3 of 3
• Tenet #3: Main-memory DBMSs are the same as a big buffer pool
• Disruption #3: Clever engineering can save lots more!
• Examples of Disruption #3:
– Specialized order-preserving & fixed-length compression within partitions permits:
• Faster access
• Performing most operations on encoded values (saves decoding cost)
• Simultaneous application of predicate conjuncts (1 compare!)
– Cache-conscious algorithms make max. use of L2 cache and large registers
– Exploit multi-core processors
– Hash-based grouping avoids sorting
27
IBM Smart Analytics Optimizer (ISAO) – Agenda
• The Third Generation of Database Technology
• Why and What is the IBM Smart Analytics Optimizer?
• ISAO Market – Business Intelligence
• ISAO Architecture
• It’s All About Performance!
• From the User’s Perspective
• What’s the Big Deal?
• Informix Warehouse with IBM Smart Analytics Optimizer
• Behind the Curtain – The Query Engine Technology
• ISAO vs. Column Stores
• Conclusions
28
Top 64 traded goods – 6 bit code
Rest
Prod Origin
Trade Info (volume, product, origin country)
CommonValues
Rare values
Nu
mb
er o
f O
ccu
ren
ces Histogram
on Origin
Histogram on Product
Origin
Pro
du
ct
ChinaUSA
GER,FRA,
… Rest
Table partitioned into Cells
Column Partitions
Vol
Compression: Frequency Partitioning
• Field lengths vary between cells– Higher Frequencies Shorter Codes (Approximate Huffman)
• Field lengths fixed within cells
Cell 4Cell 1
Cell 2
Cell 3
Cell 5
Cell 6
29
Query Processing
Compressed and Partitioned Data
QueryExecutor
core + $ (HT)core + $ (HT)
• Cell is also the unit of processing, each cell…
– Assigned to one core
– Has its own hash table in cache (so no shared object that needs latching!)• Main operator: SCAN over compressed, main-memory table
– Do selections, GROUP BY, and aggregation as part of this SCAN
– Only need de-compress for aggregation• Response time (database size) / (# cores x # nodes)
– Embarrassing Parallelism – little data exchange across nodes
DictionariesDictionaries
core + $ (HT)core + $ (HT)
core + $ (HT)core + $ (HT)
Cell 1
Cell 2
Cell 3
30
Fast Hash-based Grouping
• Encoding makes grouping simple!– Coded values assigned densely (by construction) – Hence, in principle, grouping is simple: aggTable[group] += aggValue
• Challenges:– Fitting hash table in L2 cache– Avoiding all branches in hash table lookup
• IBM Smart Analytics Optimizer adaptively uses one of 2 techniques, depending on # of distinct groups1. Use dictionary code as a perfect hash (i.e. collision-free), OR
• aggTable[groupCode] += aggValue
• No branches, no hash function computation
• Works great if groupCode is dense – i.e., single column, or multiple column with little
correlation
2. Use usual linear probing
• Involves branches, random access, …
31
Joins
• Basic idea: Re-write Join as multiple scans:
1. Over each dimension, to form:
A list of qualifying primary keys (PKs), decoded
A hash-map of primary key auxiliary columns (those used later in query for GROUP BY, etc.)
2. Over fact table:
First convert PKs to foreign keys (FKs) in fact table column
Apply as (very big) IN-list predicates (a semi-join), one per dimension
Look up into hash-maps to pick up other columns
Complete Grouping and Aggregation
• Snowflakes: apply repeatedly, outside in
(1a) Dimension A
scan(A)
σa
IN-list of A.k1
Hash-map:A.k1 A.g
(1b) Dimension B
scan(B)
σb
IN-list of B.k2, B.k3
Hash-map:B.k2, B.k3 B.h
(2) Fact
scan(F)
σf
GROUP BY, Aggregation
σ: F.fk1
IN …
σ: F.fk2, F.fk3
IN …
Look up values of g, h
32
IBM Smart Analytics Optimizer (ISAO) – Agenda
• Why and What is the IBM Smart Analytics Optimizer?
• ISAO Market – Business Intelligence
• ISAO Architecture
• It’s All About Performance!
• From the User’s Perspective
• What’s the Big Deal?
• Behind the Curtain – The Query Engine Technology
• ISAO vs. Column Stores
• Conclusions
33
Banks and Tuplets in IBM Smart Analytics Optimizer• A bank is a vertical partition of a table, containing a subset of its columns
–Assignment of columns to banks is cell-specific, since column’s length • Varies from cell to cell, but
• Is fixed within a cell–Banks contain
• Concatenations of the fixed-length column codes
• Padded to the nearest fraction of a word length (8 / 16 / 32 / 64 bits).
• We call these word-sized units tuplets.
• ISAO’s bank-major layouts are a hybrid of row-major and column-major
A1 D1 G1
A2 D2 G2
A4 D4 G4
B1 E1 F1
B2 E2 F2
B4 E4 F4
C1 H1
C3 H3
C4 H4
Bank β1 (32 bits) Bank β2 (32 bits)Bank β3 (16 bits)
Ce
ll Blo
ckA3 D3 G3 B3 E3 F3
C2 H2
34
Register Stores Facilitate SIMD Parallelism
• Access only the banks referenced in the query (like a column store):
–SELECT SUM (T.G) –FROM T–WHERE T.A > 5–GROUP BY T.D
• Pack multiple rows from the same bank into the 128-bit register
• Enables yet another layer of parallelism: SIMD (Single-Instruction, Multiple-Data)!
A1 D1 G1
A2 D2 G2
A4 D4 G4
Bank β1 (32 bits)
A3 D3 G3
B1 E1 F1
B2 E2 F2
B4 E4 F4
C1 H1
C3 H3
C4 H4
Bank β2 (32 bits)Bank β3 (16 bits)
Ce
ll Blo
ck
B3 E3 F3
C2 H2
32 bits 32 bits32 bits32 bits
128 bitsResult1 Result2 Result3 Result4
Operand Operand Operand Operand
Vector Operation
35
Simultaneous Evaluation of Equality Predicates
State==‘CA’ && Quarter == ‘Q4’
State==01001 && Quarter==1110
Translate value queryto Code query
Row
Mask
Selectionresult
… … … …
11111 0 1111 0
01001 0 1110 0
==
&
• CPU operates on 128-bit units
• Lots of fields fit in 128 bits
• These fields are at fixed offsets
• Apply predicates to all columns simultaneously!
State Quarter
36
IBM Smart Analytics Optimizer vs. a Column Store
Aspect Column Store IBM Smart Analytics Optimizer
Compression Every column padded to word boundary
more padding/column
worse compression
Multiple columns / word less padding overhead
Query Processing Like having an index on every column
To answer query:
Determine list(s) of matching records
Intersect these lists on RID
Can skip blocks based upon predicates
To answer query:
Do multi-bank scan
Updating Insert requires:
Separate updates to every column
Multiple random I/Os, 1/column
Insert requires:
Single update to each bank, 1 / bank
One I/O to one cell block
Evaluation Matches Hardware?
Evaluation doesn’t match w/ Hardware:
Column materialization involves random accesses
Code logic involves many branches
Predicate evaluation has to be done serially
Evaluation matches with Hardware
Scan does sequential memory access
Almost no branches
Simultaneous predicate evaluation
SIMD predicate evaluation
37
Refereed Publications in Top 3 Professional Conferences
• VLDB 2008: “Main-Memory Scan Sharing for Multi-core CPUs”, Lin Qiao, Vijayshankar Raman, Frederick Reiss, Peter Haas, Guy Lohman
• VLDB 2008: “Row-Wise Parallel Predicate Evaluation”, Ryan Johnson, Vijayshankar Raman, Richard Sidle, Garret Swart
• VLDB 2006: “How to wring a table Dry: Entropy Compression of Relations and Querying Compressed Relations”, Vijayshankar Raman, Garret Swart
• SIGMOD 2007: “How to barter bits for chronons: compression and bandwidth trade offs for database scans”, Allison L. Holloway, Vijayshankar Raman, Garret Swart, David J. DeWitt
• ICDE 2008: “Constant-time Query Processing”, Vijayshankar Raman, Garret Swart, Lin Qiao, Frederick Reiss, Vijay Dialani, Donald Kossmann, Inderpal Narang, Richard Sidle
VLDB = International Conference on Very Large Data Bases
SIGMOD = ACM SIGMOD International Conference on Management of Data
ICDE = IEEE International Conference on Data Engineering
38
Conclusions• Radical changes are happening in hardware
– Large, cheap memories
– Multi-core processors promise cheap, massive CPU parallelism
• IBM Smart Analytics Optimizer exploits these trends:
– Special-purpose accelerator (BI only, snapshot semantics, no transactions)– Main-memory DBMS – Massive parallelism of commodity multi-core hardware (blade center format)– Query processing on compressed values!– Cache-conscious algorithms
• IBM Smart Analytics Optimizer speeds up your problem queries the most!
• IBM Smart Analytics Optimizer is an appliance that is transparent to the user
– Minimal set-up– Applications need not change– Tuning not needed!– Lower TCO
39
Disclaimers
• This talk is about proof of concept of a technology developed at IBM research labs.
• This is NOT a talk on IBM Informix product or planned release.
• Please read the previous disclaimer page carefully.
40
Information and Analytics Communities
• On-line communities, User Groups, Technical Forums, Blogs, Social networks, and more
– Find a community that interests you at…
• ibm.com/software/data/community
• Information Champions
– Recognizing individuals who have made the most outstanding contributions to Information Management communities
• ibm.com/software/data/champion
4141
Thank You!Your Feedback is Important to Us
• Access your personal session survey list and complete via SmartSite
– Your smart phone or web browser at: iodsmartsite.com
– Any SmartSite kiosk onsite
– Each completed session survey increases your chance to win an Apple iPod Touch with daily drawing sponsored by Alliance Tech
– Session number 1971
42
Thank You
MerciGrazie
Gracias
Obrigado
Danke
Japanese
English
French
Russian
German
Italian
Spanish
Brazilian Portuguese
Arabic
Traditional Chinese
Simplified Chinese
Hindi
Tamil
Thai
Korean