Skew-Aware Automatic Database Partitioning in Shared- Nothing, Parallel OLTP Systems
SIGMOD 2012, Pavlo et al. Hefu Chai
Skew-Aware Automatic Database Partitioning in Shared- Nothing, - - PowerPoint PPT Presentation
Skew-Aware Automatic Database Partitioning in Shared- Nothing, Parallel OLTP Systems SIGMOD 2012, Pavlo et al. Hefu Chai Credit Part of slides from Andy Pavlo There is a saying Girls are really only interested in two things. They
SIGMOD 2012, Pavlo et al. Hefu Chai
Credit
There is a saying…
good looking, or they want a guy that really knows a lot about databases. Andy Pavlo
4
Client Application
Database Cluster
Procedure Name Input Parameters
Transaction Execution
Database Cluster
Transaction Result
5
Existing database partitioning Techniques
Not applicable to OLTP systems !
We need an approach that supports…
Automatic Database Design Tool for Parallel Systems
Skew-Aware Automatic Database Partitioning in Shared-Nothing, Parallel OLTP Systems
SIGMOD 2012
What are the key issues
25,000 50,000 75,000 100,000 125,000 150,000 4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64
txn/s Partitions
No Distributed Txns 20% Distributed Txns
TPC-C NewOrder
11
Distributed transactions
What are the key issues
Temporal workload skew
load across the cluster for any point is unbalanced
CUSTOME R ORDERS ITEM CUSTOME R ORDERS ITEM CUSTOME R ORDERS ITEM CUSTOME R ORDERS ITEM
…
Skew Estimator DTxn Estimator
Schema Workload
DDL
SELECT * FROM WARE REHO HOUSE USE WHERE W_ID = 10; INSERT INTO ORDERS ERS (O_W_ID, O_D_ID, O_C_ID) VALUES (10, 9, 12345);
⋮
SELECT * FROM WARE REHOUSE HOUSE WHERE W_ID = 10; INSERT INTO ORDERS ERS (O_W_ID, O_D_ID, O_C_ID) VALUES (10, 9, 12345);
⋮
SELECT * FROM WARE REHO HOUSE USE WHERE W_ID = 10; SELECT * FROM DISTRICT RICT D_W_ID = 10 AND D_ID =9; INSERT INTO ORDERS ERS (O_W_ID, O_D_ID, O_C_ID) VALUES (10, 9, 12345);
⋮
SELECT * FROM WAREHOUSE WHERE W_ID = 10; SELECT * FROM DISTRICT WHERE D_W_ID = 10 AND D_ID =9; INSERT INTO ORDERS (O_W_ID, O_D_ID, O_C_ID,…) VALUES (10, 9, 12345,…);
⋮
CUSTOMER ORDERS ITEM
14
between distributed transactions and temporal skew
to include replicated secondary indexes
stored procedure routing Large Neighborhood Search Skew-Aware Cost Model
For each table:
What are the design options
_id
id …
78703 1004 5
1002 3
1006 7
1005 6
1005 6
1003 12
c_w_id id c_last st …
1001 5 RZA
3 GZA
12 Raekwon
5 Deck
6 Killah
7 ODB
ORDERS
CUSTOMER ORDERS CUSTOMER ORDERS CUSTOMER ORDERS
17
Horizontal Partitioning
CUSTOMER ORDERS CUSTOMER ORDERS CUSTOMER ORDERS
ITEM
i_id i_name i_price ice …
603514 XXX 23.99
XXX 19.99
XXX 14.99
XXX 9.98
XXX 103.49
XXX 69.99
ITEM ITEM
18
Table Replication
CUSTOMER ORDERS CUSTOMER ORDERS CUSTOMER ORDERS ITM ITEM ITEM
CUSTOMER
c_id c_w_id id c_last st …
1001 5 RZA
3 GZA
12 Raekwon
5 Deck
6 Killah
7 ODB
Secondary Index
CUSTOMER ORDERS CUSTOMER ORDERS CUSTOMER ORDERS ITEM ITEM ITEM
Client Application NewOrder(5, “Method Man”, 1234)
20
Stored Procedure Routing
What are the key technique contributions
Input
Workload
DD DD L
Initial Design
22
Initial Design
Initial Design Relaxation
23
Relaxation
Best Design Relaxation Local Search Restart
24
Local Search
What are the key technique contributions
Skew-Aware Cost Model
are set
Skew-Aware Cost Model
Tradeoff!
Skew-Aware Cost Model
Total number of partitions accessed divided by total number of partitions could have been accessed, and scale it up.
Coordinator Cost
Skew-Aware Cost Model
To avoid time varying skew, divide W into finite intervals
Skew Factor
Incomplete Designs
monotonically increase!
Optimizations
Vertex: Table Edge: tables are co-accessed Weight of edges: the number of times the queries forming the relationship Access Graph
Optimizations
Workload Compression
TA TATP TP TPC TPC-C TPC TPC-C C Sk Skew ewed ed
(txn/s /s)
Horticulture State-of-the-Art
10,000 10,000 20,000 20,000 30,000 30,000 40,000 40,000 50,000 50,000 60, 60,000 000 4 8 16 16 32 32 64 64 2, 2,000 000 4, 4,000 000 6, 6,000 000 8, 8,000 000 10,000 10,000 12,000 12,000 14, 14,000 000 4 8 16 16 32 32 64 64 10,000 10,000 20,000 20,000 30,000 30,000 40,000 40,000 50,000 50,000 60,000 60,000 70,000 70,000 80, 80,000 000 4 8 16 16 32 32 64 64
TATP SEATS TPC-C TPC-C Skewed AuctionMark TPC-E
% Single-Partitioned Transactions
38
Andy: it works !