Date post: | 26-Dec-2015 |
Category: |
Documents |
Upload: | eleanor-horn |
View: | 214 times |
Download: | 1 times |
COMMUNICATION STEPS FOR PARALLEL QUERY PROCESSING
Paraschos KoutrisPaul BeameDan Suciu
University of WashingtonPODS 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
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
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
. . .
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 ?
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
OUTLINE
1. Warm-up: The Triangle Query2. One Communication Round3. Multiple Communication Rounds
7
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
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
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))
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
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
OUTLINE
1. Warm-up: The Triangle Query2. One Communication Round3. Multiple Communication Rounds
13
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
… … …
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)
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
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)
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))
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
OUTLINE
1. Warmup: The Triangle Query2. One Communication Round3. Multiple Communication Rounds
20
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
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
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
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
Thank you !
25