250 likes | 528 Views
Communication Steps For Parallel Query Processing. 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
E N D
Communication Steps For Parallel Query Processing ParaschosKoutris Paul Beame Dan Suciu University of Washington PODS 2013
Motivation • Understand the complexity of parallel query processing on big data • Focus on shared-nothingarchitectures • MapReduceis such an example • Dominating parameters of computation: • Communication cost • Number of communication rounds
Computation Models • The MapReducemodel • [Afratiet 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
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 Server 1 Input N . . . . . . . . . . . . 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 roundsr • Space exponent ε(governs data replication) 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
Outline • Warm-up: The Triangle Query • One Communication Round • Multiple Communication Rounds
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 hypergraphof the query Q: • Variables as vertices • Atoms as hyperedges S x w R y v z T
The Triangle Query (1) • Find all trianglesQ(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) • JoinlocallyU(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) • JoinlocallyQ(a,b,c) = {U(a, b ,c), T(c, a)} • Replicationε = 0
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] • Sendeachtupleto servers: • R(a, b) (h1(a), h2(b), - ) • S(b, c) (-, h2(b), h3(c) ) eachtuplereplicatedp1/3times • T(c, a) (h1(a), -, h3(c) ) • Replicationε = 1/3 • (h1(a), h2(b), h3(c))
Lower Bound For Triangles (1) • Theorem: No (randomized) algorithm can compute triangles in one round with space exponent ε < 1/3 • 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/pfraction of input: N/pbits
Lower Bound For Triangles (2) • axy = Pr[server knows tuple R(x,y)] • axy ≤ 1/n • ∑x,yaxy = O(n/p) • Similarly for S(y,z), T(z,x): byz, czx • Friedgut’s inequality: ∑x,y,zaxybyzczx ≤ (∑x,yaxy2)1/2 (∑y,zbyz2)1/2 (∑z,xczx2)½ • #know-triangles = O(1/p3/2) • Summing over all servers, O(1/p1/2) known output tuples
Outline • Warm-up: The Triangle Query • One Communication Round • Multiple Communication Rounds
Matching Databases • Every relation R(A1, …, Ak) contains exactly n tuples • Every attribute Aicontains each value in {1, …, n} only once • A matching database has no skew Relation R(X, Y, Z) 1 1 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 Vertex Cover τ = 2 1/2 Fractional Vertex Cover τ* = 3/2 x 0 w 1/2 y 0 v 1/2 z Q(x, y, z, w, v) = R(x,y,z), S(x,w,v), T(v,z)
Lower Bounds • 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 • Theorem: The HYPERCUBE (randomized) algorithm can compute any Conjunctive QueryQwith: • 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 / τ* • Assigneachof the p servers topoints on a k-dimensional hypercube: [p] = [pe(1)] × … × [pe(k)] • Hasheachtupleto the appropriatesubcube 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 • 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 • Warmup: The Triangle Query • One Communication Round • Multiple Communication Rounds
Multiple Rounds • Ourresultsapplyto a weakermodel (tuple-based MPC): • onlyjointuplescan be sent in rounds > 1 e.g.{R(a,b), S(b,c)} • routingofeachtuple tdependsonly on t • Theorem: For every tree-like query Q, any tuple-based MPC algorithm requires at least • log(diam(Q)) / log2/(1-ε) rounds • This bound agrees with the upper bound within 1 round • diam(Q): largestdistancebetweentwovertices in the hypergraph • tree-like queries: #variables + #atoms - Σ(arities) = 1
Example • 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 diameter = k xk x1 x2 x3 x4 …
Connected Components • As a corollaryofourresults for multiplerounds, weobtainlowerboundsbeyondconjunctivequeries: Theorem: Any tuple-based MPC algorithm that computes the Connected Components in any undirected graph with space exponent any ε<1 requires requires Ω(logp)communicationrounds
Conclusions • Tightlower and upper boundsfor 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