c ommunication s teps f or p arallel q uery p rocessing paraschos koutris paul beame dan suciu...

25
COMMUNICATION STEPS FOR PARALLEL QUERY PROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

Upload: eleanor-horn

Post on 26-Dec-2015

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

COMMUNICATION STEPS FOR PARALLEL QUERY PROCESSING

Paraschos KoutrisPaul BeameDan Suciu

University of WashingtonPODS 2013

Page 2: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

MOTIVATION

• Understand the complexity of parallel query processing on big data

• Focus on shared-nothing architectures– MapReduce is such an example

• Dominating parameters of computation:– Communication cost– Number of communication rounds

2

Page 3: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

COMPUTATION MODELS

• The MapReduce model– [Afrati et al., 2012] tradeoff between reducer size (input size of a

reducer) and replication rate (in how many reducers a tuple is sent)

• The MUD model [Feldman et al., 2010] – (Massive, Unordered, Distributed) model

• The MRC model [Karloff et al., 2010]

– MapReduce computation + load balancing

3

Page 4: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

THE MPC MODEL

• N: total input size (in bits)• p: number of servers

– Servers have unlimited computational power

• Computation proceeds in synchronous rounds:– Local computation– Global communication

4

Input N...

.

.

.

.

.

.

Server 1

Server p

Round 1 Round 2

. . .

Page 5: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

MPC PARAMETERS

• Each server receives in total a bounded number of bits:O(N/p × pε) 0 ≤ < 1ε

• Complexity parameters:– Number of computation rounds r– Space exponent ε (governs data replication)

5

What are the space exponent/round tradeoffs for query processing in the MPC model ?

Page 6: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

OUR RESULTS

• ONE ROUND: – Lower bounds on the space exponent for any (randomized)

algorithm that computes a Conjunctive Query– The lower bound holds for a class of inputs (matching databases),

for which we show tight upper bounds

• MULTIPLE ROUNDS:– Almost tight space exponent/round tradeoffs for tree-like

Conjunctive Queries under a weaker communication model

6

Page 7: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

OUTLINE

1. Warm-up: The Triangle Query2. One Communication Round3. Multiple Communication Rounds

7

Page 8: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

CONJUNCTIVE QUERIES

• We mainly study full Conjuctive Queries w/o self-joins:Q(x, y, z, w, v) = R(x,y,z), S(x,w,v), T(v,z)

• The hypergraph of the query Q:– Variables as vertices– Atoms as hyperedges

8

x

y

zv

wR

S

T

Page 9: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

THE TRIANGLE QUERY (1)

• Find all triangles Q(x,y,z) = R(x,y), S(y,z), T(z,x)• 2-round Algorithm:

– ROUND 1: [R hash-join S]• R(a, b) h(b)• S(b, c) h(b)• Join locally U(a, b, c) = {R(a, b), S(b, c)}

– ROUND 2: [T’ hash-join T]• U(a, b, c) h(c)• T(c, a) h(c)• Join locally Q(a,b,c) = {U(a, b ,c), T(c, a)}

– Replication ε = 0

9

Page 10: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

THE TRIANGLE QUERY (2)

• 1-round Algorithm: [Ganguly ’92, Afrati ’10, Suri ’11]

– The p servers form a cube: [p1/3] × [p1/3] × [p1/3] – Send each tuple to servers:

• R(a, b) (h1(a), h2(b), - )

• S(b, c) (-, h2(b), h3(c) ) each tuple replicated p1/3 times

• T(c, a) (h1(a), -, h3(c) )

• Replication ε = 1/3

10

(h1(a), h2(b), h3(c))

Page 11: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

LOWER BOUND FOR TRIANGLES (1)

• Say that R, S, T are random permutations over [n]2

• Expected #triangles = 1

Lemma: For any deterministic algorithm and ε=0, the p servers report in expectation O(1/p1/2 ) tuples

• Each relation contains N = (n logn) bits of information• Any server knows a 1/p fraction of input: N/p bits

11

Theorem: No (randomized) algorithm can compute triangles in one round with space exponent ε < 1/3

Page 12: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

LOWER BOUND FOR TRIANGLES (2)

• axy = Pr[server knows tuple R(x,y)]

• axy ≤ 1/n

• ∑x,y axy = O(n/p)

• Similarly for S(y,z), T(z,x): byz, czx

• Friedgut’s inequality: ∑x,y,z axy byz czx ≤ (∑x,y axy

2)1/2 (∑y,z byz2)1/2 (∑z,x czx

2)½

• #know-triangles = O(1/p3/2)• Summing over all servers, O(1/p1/2) known output tuples

12

Page 13: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

OUTLINE

1. Warm-up: The Triangle Query2. One Communication Round3. Multiple Communication Rounds

13

Page 14: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

MATCHING DATABASES

• Every relation R(A1, …, Ak) contains exactly n tuples

• Every attribute Ai contains each value in {1, …, n} only once

• A matching database has no skew

14

1

2

n-1

n

Relation R(X, Y, Z)1

2

3

n

X Y Z

1 3 2

2 2 3

n-1 n n

… … …

Page 15: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

FRACTIONAL VERTEX COVER

• Vertex cover number τ: minimum number of variables that cover every hyperedge

• Fractional vertex cover number τ*: minimum weight of variables such that each hyperedge has weight at least 1

15

Vertex Cover τ = 2

1/2

1/2

1/2Fractional Vertex Cover τ* = 3/2

0

0x

y

zv

w

Q(x, y, z, w, v) = R(x,y,z), S(x,w,v), T(v,z)

Page 16: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

LOWER BOUNDS

16

Theorem: Any randomized algorithm in the MPC model will fail to compute a Conjunctive Query Q with:• 1 round • ε < 1 – 1/ τ*(Q)• Input a matching database

Page 17: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

UPPER BOUNDS

17

Theorem: The HYPERCUBE (randomized) algorithm can compute any Conjunctive Query Q with:• 1 round • ε ≥ 1 – 1/ τ*(Q)• Input a matching database (no skew)• Exponentially small probability of failure (on input N)

Page 18: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

HYPERCUBE ALGORITHM

• Q(x1,…, xk) = S1(…), …, Sl(…)

• Compute τ* and minimum cover: v1, v2, …, vk

• Assign to each variable xi a share exponent

e(i) = vi / τ*

• Assign each of the p servers to points on a k-dimensional hypercube:

[p] = [pe(1)] × … × [pe(k)]• Hash each tuple to the appropriate

subcube

18

Q(x,y,z,w,v)=R(x,y,z),S(x,w,v),T(v,z) τ* = 3/2 : vx = vv = vz = ½

vy = vw = 0

e(x) = e(v) = e(z) = 1/3 e(y) = e(w) = 0

[p] =[p1/3]×[p0]×[p1/3]×[p0]×[p1/3]

e.g. S(a,b,c) (hx(a), 1, -, 1, hv(c))

Page 19: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

EXAMPLES

19

• Cycle query: Ck(x1,…, xk) = S1(x1, x2), …, Sk(xk, x1)– τ* = k/2– ε = 1 - 2/k

• Star query: Tk(z, x1,…, xk) = S1(z, x1), …, Sk(z, xk)– τ* = 1– ε = 0

• Line query: Lk(x0, x1,…, xk) = S1(x0, x1), …, Sk(xk-1, xk)– τ* = k/2

– ε = 1 - 1/ k/2

Page 20: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

OUTLINE

1. Warmup: The Triangle Query2. One Communication Round3. Multiple Communication Rounds

20

Page 21: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

MULTIPLE ROUNDS

21

• Our results apply to a weaker model (tuple-based MPC):– only join tuples can be sent in rounds > 1 e.g. {R(a,b), S(b,c)}– routing of each tuple t depends only on t

Theorem: For every tree-like query Q, any tuple-based MPC algorithm requires at least log(diam(Q)) / log2/(1- )ε roundsThis bound agrees with the upper bound within 1 round

• diam(Q): largest distance between two vertices in the hypergraph• tree-like queries: #variables + #atoms - Σ(arities) = 1

Page 22: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

EXAMPLE

22

• Line query: Lk(x0,x1,…, xk) = S1(x0,x1), …, Sk(xk-1,xk)– tree-like:

• #variables = k+1• #atoms = k• Σ(arities) = 2k

– diam(Lk) = k

– For space exponent = 0, ε we need at least log(k)/log(2/(1-0)) = log(k) rounds

x1 x2 x3 x4 … xk

diameter = k

Page 23: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

CONNECTED COMPONENTS

23

• As a corollary of our results for multiple rounds, we obtain lower bounds beyond conjunctive queries:

Theorem: Any tuple-based MPC algorithm that computes the Connected Components in any undirected graph with space exponent any ε<1 requires requires Ω(log p) communication rounds

Page 24: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

CONCLUSIONS

• Tight lower and upper bounds for one communication round in the MPC model

• The first lower bounds for multiple communication rounds• Connected components cannot be computed in a constant

number of rounds

• Open Problems:– Lower and upper bounds for skewed data– Lower bounds for > 1 rounds in the general model

24

Page 25: C OMMUNICATION S TEPS F OR P ARALLEL Q UERY P ROCESSING Paraschos Koutris Paul Beame Dan Suciu University of Washington PODS 2013

Thank you !

25