Abstract
This study evaluates the performance of three-way joins in distributed environments using MapReduce. We compare the "one-round" algorithm (1,3J), which uses a multi-way join strategy, against the traditional "cascade" approach (2,3J) of sequential two-way joins. Through experiments on seven real-world sparse graph datasets, we demonstrate that while the one-round algorithm exhibits superior scalability for result enumeration, the cascade approach remains more efficient when intermediate aggregation is required.
Introduction
Joins are fundamental operations in data processing, essential for tasks ranging from social network analysis to large-scale matrix multiplication. As datasets grow to the scale of the open web, distributed frameworks like MapReduce become necessary. Joining three tables ($R \bowtie S \bowtie T$) presents a strategic choice: execute two separate joins in sequence (the cascade) or employ a specialized multi-way algorithm to complete the operation in a single round.
The one-round algorithm (1,3J) aims to minimize MapReduce overhead by processing the entire join at once. However, this requires data replication to ensure all matching tuples meet at the same reducer. This paper investigates the practical trade-offs between these strategies on large-scale, real-world datasets.
Algorithmic Strategies
We evaluate two primary strategies for performing three-way joins:
- The Cascade (2,3J): This traditional approach involves two sequential MapReduce rounds. The first round joins $R$ and $S$, and the second round joins the resulting intermediate table with $T$.
- The One-Round Join (1,3J): Based on the work of Afrati and Ullman, this algorithm maps reducers to a 2D grid. As illustrated in Figure 1, the "middle" table ($S$) is partitioned across the grid, while the "outer" tables ($R$ and $T$) are replicated across rows or columns. This ensures that every potential match between $R$, $S$, and $T$ is evaluated by at least one reducer.
We also consider variants that include aggregation (1,3JA and 2,3JA). In the cascade version, aggregation can be performed immediately after the first join round, potentially reducing the data volume before the second round.
Experimental Setup
The study utilizes seven directed graph datasets from the Stanford Large Network Dataset Collection (SNAP), including social networks (Twitter, Pokec, LiveJournal), communication graphs (Wikitalk), and web/product graphs (Google Web, Amazon). These datasets are representative of "sparse" data, where the number of actual connections is a small fraction of the possible connections—a crucial characteristic in real-world big data applications.
Results and Discussion
Communication Cost and Scalability
A significant finding of this study is the "scalability surprise." Theoretical models often predict that the data replication required by 1,3J will lead to inefficiency as the number of reducers increases. However, our experiments on sparse real-world graphs show that 1,3J often remains more efficient than the cascade approach even with thousands of reducers.
As shown in Figure 3, the communication cost for 1,3J (represented by orange diamonds) is consistently lower than that of the 2,3J cascade (green circles) across most datasets. For instance, in the Twitter dataset, the 1,3J algorithm would require over 67,000 reducers before its communication cost exceeded that of the cascade. For Wikitalk, that threshold was over 76,000 reducers.
The Impact of Aggregation
The advantage shifts significantly when the goal is aggregation rather than simple enumeration. In the cascade approach (2,3JA), performing aggregation after the first join round drastically reduces the intermediate data size. For the Twitter dataset, the aggregated intermediate result was only 7.4% of the size of the raw join result.
In contrast, the one-round algorithm must produce the full join result before any aggregation can occur. This makes 1,3J significantly more expensive in terms of network I/O and communication cost when summaries are required. On the LiveJournal dataset, the final output of the aggregated cascade was only 42.2% of the size of the raw 1,3J output, representing a massive saving in I/O and network traffic.
Conclusion
This experimental study highlights the importance of data characteristics and task requirements when choosing a join strategy. For enumerating matches in sparse graphs, the one-round multi-way join (1,3J) is remarkably efficient and scales better than theoretical predictions suggest. However, for tasks involving aggregation, the traditional cascade approach (2,3J) is superior due to its ability to reduce data volume early in the process.
Summary updated