<?xml version="1.0" encoding="UTF-8"?>
<TEI xml:space="preserve" xmlns="http://www.tei-c.org/ns/1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://www.tei-c.org/ns/1.0 https://raw.githubusercontent.com/kermitt2/grobid/master/grobid-home/schemas/xsd/Grobid.xsd"
 xmlns:xlink="http://www.w3.org/1999/xlink">
	<teiHeader xml:lang="en">
		<fileDesc>
			<titleStmt>
				<title level="a" type="main">Using Statistics for Computing Joins with MapReduce</title>
			</titleStmt>
			<publicationStmt>
				<publisher/>
				<availability status="unknown"><licence/></availability>
			</publicationStmt>
			<sourceDesc>
				<biblStruct>
					<analytic>
						<author>
							<persName><forename type="first">Theresa</forename><surname>Csar</surname></persName>
							<email>csar@dbai.tuwien.ac.at</email>
							<affiliation key="aff0">
								<orgName type="institution">Vienna University of Technology</orgName>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Reinhard</forename><surname>Pichler</surname></persName>
							<email>pichler@dbai.tuwien.ac.at</email>
							<affiliation key="aff0">
								<orgName type="institution">Vienna University of Technology</orgName>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Emanuel</forename><surname>Sallinger</surname></persName>
							<email>sallinger@dbai.tuwien.ac.at</email>
							<affiliation key="aff0">
								<orgName type="institution">Vienna University of Technology</orgName>
							</affiliation>
						</author>
						<author>
							<persName><forename type="first">Vadim</forename><surname>Savenkov</surname></persName>
							<email>vadim.savenkov@wu.ac.at</email>
							<affiliation key="aff1">
								<orgName type="institution">Vienna University of Economy</orgName>
							</affiliation>
						</author>
						<title level="a" type="main">Using Statistics for Computing Joins with MapReduce</title>
					</analytic>
					<monogr>
						<imprint>
							<date/>
						</imprint>
					</monogr>
					<idno type="MD5">D61D9A5D1ABACF2AC122F26EFB3E4BB9</idno>
				</biblStruct>
			</sourceDesc>
		</fileDesc>
		<encodingDesc>
			<appInfo>
				<application version="0.7.2" ident="GROBID" when="2023-03-24T03:02+0000">
					<desc>GROBID - A machine learning software for extracting information from scholarly documents</desc>
					<ref target="https://github.com/kermitt2/grobid"/>
				</application>
			</appInfo>
		</encodingDesc>
		<profileDesc>
			<abstract/>
		</profileDesc>
	</teiHeader>
	<text xml:lang="en">
		<body>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1">Introduction</head><p>The MapReduce model has been designed to cope with ever-growing amounts of data <ref type="bibr" target="#b3">[4]</ref>. It has been successfully applied to various computational problems. In recent years, multiple MapReduce algorithms have also been developed for computing joins -one of the fundamental problems in managing and querying data.</p><p>The main optimization goals of these algorithms for distributing the computation tasks to the available reducers are the replication rate and the maximum load of the reducers. The HyperCube algorithm of Afrati and Ullman <ref type="bibr" target="#b0">[1]</ref> minimizes the former by considering only the size of the involved tables. This algorithm was later enhanced by Beame et al. <ref type="bibr" target="#b2">[3]</ref> to minimize the latter by taking into account also so-called "heavy hitters" (i.e., attribute values that occur particularly often). However, in contrast to most state-of-the-art database management systems, more elaborate statistics on the distribution of data values have not been used for optimization purposes so far.</p><p>Recently, several approaches for handling skew in the computation of joins have been proposed, improving the partitioning of the data using histograms or varying a cost model <ref type="bibr" target="#b5">[6,</ref><ref type="bibr" target="#b6">7]</ref>, but there is still ample room for enhancements and optimization. In <ref type="bibr" target="#b4">[5]</ref> a survey of recent approaches for dealing with the weaknesses and limitations of the MapReduce model can be found.</p><p>The goal of this paper is to study the potential benefit of using more fine-grained statistics on the distribution of data values in MapReduce algorithms for join computation. To this end, we investigate the performance of known algorithms <ref type="bibr" target="#b0">[1,</ref><ref type="bibr" target="#b2">3]</ref> in the presence of skewed data, and extend them by utilizing data statistics. We compare the original algorithms with a modified one that makes use of additional statistical measures. Our initial study shows that our approach can indeed improve existing methods.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2">Preliminaries</head><p>A MapReduce join computation consists of three basic phases. First, in the Map-Phase, a key-value is assigned to every tuple. In the Shuffle-Phase, the tuples are distributed among the reduce tasks (also called reducers) according to their key-values. In the final Reduce-Phase, each reducer performs the join on all its tuples. The theoretical foundations of MapReduce query processing have been laid among others by <ref type="bibr" target="#b0">[1]</ref><ref type="bibr" target="#b1">[2]</ref><ref type="bibr" target="#b2">[3]</ref>, based on the HyperCube algorithm outlined below.</p><p>The HyperCube Algorithm. Key-values for tuples are formed by concatenating the hashes of the join attributes. Consider the triangle join R(A, B) 1 S(B, C) 1 T (C, A) in which all attributes A, B and C are join attributes. Key-values are triples (a i , b i , c i ) obtained by the respective hash functions h a , h b and h c . A tuple is sent to all reducers that may have join candidates for it. For instance, the tuple R(a 1 , b 1 ) is sent to the reducers identified by keys of the form (h a (a 1 ), h b (b 1 ), * ) where * matches any value in the range of h c . We take <ref type="bibr">[1, a]</ref>, <ref type="bibr">[1, b]</ref> and <ref type="bibr">[1, c]</ref> to be the ranges of the respective hash functions h a , h b and h c . The size the range is called the share of the attribute. The respective shares are thus a, b and c, and the total number of reducers equals the product of the shares: k = abc.</p><p>An important measure for the performance of the HyperCube algorithm is the replication rate. For instance, each R-tuple R(a i , b i ) is replicated c times, since it is sent to the reducers responsible for the keys (h(a i ), h(b i ), 1), . . . , (h(a i ), h(b i ), c). The replication rate for the triangle join is rc+sa+tb, where r, s and t are the sizes of the tables. In <ref type="bibr" target="#b0">[1]</ref>, shares are chosen in order to minimize the replication rate. The solution for the shares for the triangle query in the model of <ref type="bibr" target="#b0">[1]</ref> </p><formula xml:id="formula_0">is a = 3 krt s 2 , b = 3 krs t 2 and c = 3 kst r 2 . For the four-atom chain query R(A, B) 1 S(B, C) 1 T (C, D) 1 U (D, E)</formula><p>, the solutions for the shares are b = d rs tu , c = st ru and d = ku s . In <ref type="bibr" target="#b2">[3]</ref>, the shares are chosen to minimize the maximum load per reducer, that is, the maximum number of tuples sent to a single reducer. The shares are calculated as the solution to a linear program. In contrast to <ref type="bibr" target="#b0">[1]</ref>, the method in <ref type="bibr" target="#b2">[3]</ref> also addresses the problem of skew by treating heavy hitters separately. Also the expected load and maximum load per server is analyzed in <ref type="bibr" target="#b2">[3]</ref>, and a lower bound for the maximum load per server is given.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3">An Empirical Study and the Need for Statistics</head><p>The goal of our study is to compare the performance of HyperCube-based algorithms. To this end, we investigate how the shares chosen by such methods influence the workload distributions among the reduce tasks, in particular the maximum load. The analysis was performed on two well-studied types of queries, namely the triangle query (R(A, B) 1 S(B, C) 1 T (C, A)) and the chain query of length four (R(A, B) 1 S(B, C) 1 T (C, D) 1 U (D, E)). In both cases, there are three join attributes.</p><p>Methods. Apart from known methods for computing shares, namely <ref type="bibr" target="#b0">[1]</ref> (which we shall call AU) and <ref type="bibr" target="#b2">[3]</ref> (which we shall call BKS), we next introduce baseline methods as well as weighted variants of AU that take into account additional statistics. To facilitate a fair comparison, the shares produced by each method are normalized in the following way: they are rounded to integer values in such a way that the product of the shares is as close as possible to the fixed number of reduce tasks k. Shares have to be at least 1 and at most k. For the naive method, we define shares naive = (<ref type="foot" target="#foot_0">3</ref> </p><formula xml:id="formula_1">√ k, 3 √ k, 3 √ k).</formula><p>The worst-case we identified, worst = (k, 1, 1), will be omitted from charts to keep the differences between other methods visible. The nearly-worst-case methods we consider are defined as share1 = (2</p><formula xml:id="formula_2">3 √ k, 1</formula><p>Weigthed AU. The shares computed using AU (or BKS) depend only on the sizes of the tables, but not on other statistics indicating, e.g., the degree of skew. A simple way to detect a distribution with high variability is using the standard deviation. The more elaborate gini-coefficient is a measure for the variability of a distribution. For an observation X with possible values x 1 , . . . , x n and relative frequencies p 1 , . . . , p n , the gini-coefficient is</p><formula xml:id="formula_3">n i=1 p 2 i .</formula><p>A gini-coefficient close to 1 means that the values are very unevenly distributed.</p><p>We define our method SD as a variant of AU with the following modification: Assume that a table T has size t and attributes A and B. Instead of t, we give to AU the weighted value t • sd (T.A) • sd (T.B), where sd denotes the standard deviation of the attribute values. The Gini method is defined analogously. Finally, the variant SD2 of SD is defined by normalizing the standard deviation relative to the maximum attribute value, i.e., sd2 (T.A) := sd (T.A) / max (T.A). Note that standard deviation is only defined for numeric values (and our test scenarios use only numeric values). We leave the study of similar variations of BKS for future work.</p><p>Test Methodology. The experimental study was implemented using the programming language R (http://cran.r-project.org/). The goal of our study is to compute the work loads of all reducers, and derive in particular the maximum load and various other statistics based on the loads. Thus, we only implement the Map-Phase of the MapReduce process. To this end we compute the loads of the reducers and our presented statistics.</p><p>As databases for our test scenarios, we use randomly generated data sets where attributes are generated according to a variety of different distributions. For each such database, all methods (AU, BKS, . . .) are applied 1000 times to the input tables to compute the shares. In each round, other (randomly generated) hash functions are used. Performing 1000 repetitions is done to be able to isolate the effect of the method (in particular, the chosen shares) from the effect of the exact hash function that is used. Triangle Query. For the triangle query, we first look at a sample database generated using the methodology described above. The number of reduce tasks used is 150. The resulting maximum load at the reduce tasks can be seen in Fig. <ref type="figure">1</ref>, where it can be observed that all reasonable methods (i.e., all methods besides the nearly-worst-case ones) do not show any significant difference in the performance based on the the maximum loads. When observing the variance and the gini-coefficient of the loads, a similar picture arises. This is surprising, since the assigned shares differ a lot (see  <ref type="table">1</ref>: Shares and replication rates for the triangle and chain queries.</p><p>Triangle Query for Highly Skewed Data. For highly skewed data, we show that the AU and BKS methods do not always yield optimal maximum load. Indeed, the maximum load produced by AU and BKS exceeds the value obtained with the SD by more than 30%. We illustrate this by an example. We consider the database instance D given in Fig. <ref type="figure" target="#fig_1">3</ref> and let the maximum number of reducers be 64. Table R contains 1040 distinct tuples (a i , b i ) and the tables S and T contain groups of 16 c i,j values associated to the same a i or b j value, which sums up to 1040 values per table as well.</p><p>In total, few R tuples take part in triangles, but those that take part have 16 c i,j values that form triangles with them. Such a situation would be typical in a company where, say, few employees are department heads, but those who are department heads have a number of employees they are responsible for.</p><p>We calculated the shares, the resulting replication rate and maximum load for the discussed methods. Both AU and BKS yield shares <ref type="bibr" target="#b3">(4,</ref><ref type="bibr" target="#b3">4,</ref><ref type="bibr" target="#b3">4)</ref>. Applying the pigeonhole principle, one can show that this leads to the load of 65 + 16 + 16 = 97 tuples for most reducers as a lower bound. A much better maximum load (66 tuples for one reducer and 33 for the rest) could have been obtained using shares (8, 8, 1). The suboptimal result of AU and BKS is due to taking only table sizes into account, whereas the SD method yields the solution (8, 8, 1). An important observation here is that the actual performance of each method depends heavily on the concrete hash function and that "usual" hash functions based on integer division may by far miss the optimum.  Chain Query. For the chain query, a random database is constructed according to the methodology outlined earlier. Again, our tests are performed for 150 reduce tasks. Interestingly, the resulting maximum loads are much higher for share2, Gini, SD, and SD2 than for the other methods (see Fig. <ref type="figure">2</ref>). The high maximum load in case of Gini, SD, and SD2 suggests that some fine-tuning of the weights caused by the data statistics is needed. On the positive side, it turns out that the loads resulting from the Gini, SD, and SD2 methods are distributed more evenly among the reducers than with AU and BKS, as can be seen in Fig. <ref type="figure">5</ref>. The high variability in the median (Fig. <ref type="figure">4</ref>), especially for the Gini method, again underlines that the choice of the hash function is crucial. We have initiated the comparative study of methods for computing joins using MapReduce. We have seen that current methods perform relatively well compared to baseline and adapted methods. However, we have also seen that data-dependent statistics provide much potential for further improvement of these algorithms, which needs to be further explored. In particular, if we aim at a uniform distribution of computation tasks among the available reducers, taking into account additional statistical measures such as standard deviation or gini coefficient seems inevitable. Another important lesson learned from our investigation is the importance and difficulty of choosing an optimal hash function: even if the shares are -in theory -"optimal" for a certain criterion (such as maximum load), it is highly non-trivial to actually attain this optimum by choosing the "right" hash function. Current MapReduce research thus also has to be extended towards optimizing the hash function. Beyond that, we want to investigate the tradeoff between the cost of computing statistics and the gain provided by these statistics.</p></div><figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_0"><head>Fig. 1 : 2 :</head><label>12</label><figDesc>Fig. 1: Triangle query -maximum loads Fig. 2: Chain query -maximum loads</figDesc><graphic coords="3,137.10,473.42,169.45,118.07" type="bitmap" /></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_1"><head>Fig. 3 :</head><label>3</label><figDesc>Fig. 3: Database instance D.</figDesc></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" xml:id="fig_2"><head>Fig. 4 : 5 :</head><label>45</label><figDesc>Fig. 4: Chain query -median of loads Fig. 5: Chain query -gini of loads</figDesc><graphic coords="5,137.10,464.44,169.45,118.07" type="bitmap" /></figure>
<figure xmlns="http://www.tei-c.org/ns/1.0" type="table" xml:id="tab_0"><head></head><label></label><figDesc>Table 1a). As expected, AU yields the lowest replication rate.</figDesc><table><row><cell cols="3">method a b c replication rate</cell><cell cols="3">method b c d replication rate</cell></row><row><cell>AU</cell><cell>3 6 8</cell><cell>4.72</cell><cell>AU</cell><cell>8 3 6</cell><cell>13.3</cell></row><row><cell>BKS</cell><cell>3 6 8</cell><cell>4.72</cell><cell>BKS</cell><cell>11 2 7</cell><cell>13.5</cell></row><row><cell cols="2">Naive 5 6 5</cell><cell>4.91</cell><cell cols="2">Naive 5 6 5</cell><cell>14.5</cell></row><row><cell>Gini</cell><cell>6 5 5</cell><cell>5.55</cell><cell>Gini</cell><cell>48 1 3</cell><cell>25.9</cell></row><row><cell>SD</cell><cell>3 5 10</cell><cell>4.82</cell><cell>SD</cell><cell>1 50 3</cell><cell>33.0</cell></row><row><cell>SD2</cell><cell>2 6 11</cell><cell>4.73</cell><cell>SD2</cell><cell>7 21 1</cell><cell>41.6</cell></row><row><cell cols="2">share1 10 3 5</cell><cell>7.18</cell><cell cols="2">share1 10 3 5</cell><cell>14.4</cell></row><row><cell cols="2">share2 8 9 2</cell><cell>7.18</cell><cell cols="2">share2 8 9 2</cell><cell>23.3</cell></row><row><cell cols="2">worst 150 1 1</cell><cell>82.3</cell><cell cols="2">worst 150 1 1</cell><cell>75.6</cell></row><row><cell cols="3">(a) First triangle query</cell><cell></cell><cell cols="2">(b) Chain query</cell></row><row><cell>Table</cell><cell></cell><cell></cell><cell></cell><cell></cell><cell></cell></row></table></figure>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="3" xml:id="foot_0">√ k, 3 √ k) and share2 = ( √ k, √ k, 1), respectively.</note>
		</body>
		<back>

			<div type="acknowledgement">
<div xmlns="http://www.tei-c.org/ns/1.0"><p>Acknowledgements. This work was supported by the Austrian Science Fund projects (FWF):P25207-N23 and (FWF):Y698.</p></div>
			</div>

			<div type="references">

				<listBibl>

<biblStruct xml:id="b0">
	<analytic>
		<title level="a" type="main">Optimizing multiway joins in a map-reduce environment</title>
		<author>
			<persName><forename type="first">F</forename><forename type="middle">N</forename><surname>Afrati</surname></persName>
		</author>
		<author>
			<persName><forename type="first">J</forename><forename type="middle">D</forename><surname>Ullman</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">IEEE Trans. Knowl. Data Eng</title>
		<imprint>
			<biblScope unit="volume">23</biblScope>
			<biblScope unit="issue">9</biblScope>
			<biblScope unit="page" from="1282" to="1298" />
			<date type="published" when="2011">2011</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b1">
	<analytic>
		<title level="a" type="main">Communication steps for parallel query processing</title>
		<author>
			<persName><forename type="first">P</forename><surname>Beame</surname></persName>
		</author>
		<author>
			<persName><forename type="first">P</forename><surname>Koutris</surname></persName>
		</author>
		<author>
			<persName><forename type="first">D</forename><surname>Suciu</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Proc. PODS</title>
				<meeting>PODS</meeting>
		<imprint>
			<publisher>ACM</publisher>
			<date type="published" when="2013">2013. 2013</date>
			<biblScope unit="page" from="273" to="284" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b2">
	<analytic>
		<title level="a" type="main">Skew in parallel query processing</title>
		<author>
			<persName><forename type="first">P</forename><surname>Beame</surname></persName>
		</author>
		<author>
			<persName><forename type="first">P</forename><surname>Koutris</surname></persName>
		</author>
		<author>
			<persName><forename type="first">D</forename><surname>Suciu</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Proc. PODS 2014</title>
				<meeting>PODS 2014</meeting>
		<imprint>
			<publisher>ACM</publisher>
			<date type="published" when="2014">2014</date>
			<biblScope unit="page" from="212" to="223" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b3">
	<analytic>
		<title level="a" type="main">Mapreduce: simplified data processing on large clusters</title>
		<author>
			<persName><forename type="first">J</forename><surname>Dean</surname></persName>
		</author>
		<author>
			<persName><forename type="first">S</forename><surname>Ghemawat</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">Commun. ACM</title>
		<imprint>
			<biblScope unit="volume">51</biblScope>
			<biblScope unit="issue">1</biblScope>
			<biblScope unit="page" from="107" to="113" />
			<date type="published" when="2008">2008</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b4">
	<analytic>
		<title level="a" type="main">A survey of large-scale analytical query processing in mapreduce</title>
		<author>
			<persName><forename type="first">C</forename><surname>Doulkeridis</surname></persName>
		</author>
		<author>
			<persName><forename type="first">K</forename><surname>Nørvåg</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="j">The VLDB Journal</title>
		<imprint>
			<biblScope unit="volume">23</biblScope>
			<biblScope unit="issue">3</biblScope>
			<biblScope unit="page" from="355" to="380" />
			<date type="published" when="2014">2014</date>
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b5">
	<analytic>
		<title level="a" type="main">Load balancing in mapreduce based on scalable cardinality estimates</title>
		<author>
			<persName><forename type="first">B</forename><surname>Gufler</surname></persName>
		</author>
		<author>
			<persName><forename type="first">N</forename><surname>Augsten</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><surname>Reiser</surname></persName>
		</author>
		<author>
			<persName><forename type="first">A</forename><surname>Kemper</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Proc. ICDE</title>
				<meeting>ICDE</meeting>
		<imprint>
			<date type="published" when="2012">2012. 2012</date>
			<biblScope unit="page" from="522" to="533" />
		</imprint>
	</monogr>
</biblStruct>

<biblStruct xml:id="b6">
	<analytic>
		<title level="a" type="main">Processing theta-joins using mapreduce</title>
		<author>
			<persName><forename type="first">A</forename><surname>Okcan</surname></persName>
		</author>
		<author>
			<persName><forename type="first">M</forename><surname>Riedewald</surname></persName>
		</author>
	</analytic>
	<monogr>
		<title level="m">Proc. SIGMOD</title>
				<meeting>SIGMOD</meeting>
		<imprint>
			<publisher>ACM</publisher>
			<date type="published" when="2011">2011. 2011</date>
			<biblScope unit="page" from="949" to="960" />
		</imprint>
	</monogr>
</biblStruct>

				</listBibl>
			</div>
		</back>
	</text>
</TEI>
