Intermediate Data Caching Optimization for Multi-Stage and Parallel Big Data Frameworks

Zhengyu Yang, Danlin Jia, Stratis Ioannidis, Ningfang Mi, Bo Sheng

Introduction

In massive data processing environments like Apache Spark, computational jobs often exhibit significant computational overlaps. For example, two different machine learning tasks might perform the exact same data cleaning or dimensionality reduction steps on the same dataset.

Currently, frameworks handle this inefficiently. Developers must manually decide which intermediate results (Resilient Distributed Datasets or RDDs) to cache. When the cache is full, Spark defaults to a Least Recently Used (LRU) policy. The authors argue that LRU is inadequate because it doesn't account for the structure of the computation; a rarely used RDD that took hours to compute might be more valuable to keep than a frequently used one that takes seconds to recreate.

Figure 3: A sequence of overlapping computational DAGs ($t_1$ to $t_5$) illustrating shared intermediate stages across different jobs.

Methodology

The authors treat caching as a submodular maximization problem subject to knapsack constraints.

Mathematical Modeling

Jobs are represented as Directed Acyclic Graphs (DAGs) where nodes are operations and edges are dependencies. They define "caching gain" as the total reduction in work (time) achieved by storing specific nodes.

Figure 6: A complex computational DAG ($t_4$) featuring multiple stages and parallel dependencies.

Optimization Algorithms

  • Offline Optimization: While the problem is NP-hard, the authors show that a "pipage rounding" technique can provide a $(1 - 1/e)$ approximation of the optimal solution if job frequencies are known.
  • Adaptive Online Algorithm: Since future workloads are rarely known, they developed an adaptive algorithm using projected gradient ascent. It maintains a "probability" for each RDD to be cached, updating these values as new jobs arrive.
  • Heuristic Implementation: For practical use, they implemented a "Heuristic Adaptive Algorithm" that maintains an Exponentially Weighted Moving Average (EWMA) of the "cost-benefit" score for each RDD, considering its recomputation cost, frequency of use, and memory size.

Evaluation

The researchers evaluated their approach using three methods:

  1. Numerical Analysis: A small-scale controlled test with 5 overlapping jobs.
  2. Synthetic Traces: A large-scale simulation involving a sequence of 1,000 jobs with complex, randomly generated DAGs (averaging 6 stages and 36 RDDs per job).
  3. Real-World Benchmark: They used Ridge Regression on Apache Spark 2.2.1. The workload involved repeatedly regressing different target features against varying subsets of source features, creating a "stress test" environment with low RDD re-access rates.

Key Insights

  • The "Value" of a Node: An RDD's value is proportional to the work saved across the entire subgraph behind it. Caching a "sink" node saves the work of all its ancestors.
  • Submodularity: Caching exhibits diminishing returns. If you cache a child node, the benefit of caching its parent disappears. The authors mapped this intuition to the formal mathematical framework of submodular functions.
  • LRU's Blind Spot: In "cache-unfriendly" scenarios with high RDD churn, LRU often evicts useful data just before it's needed again. The proposed adaptive algorithm is better at detecting shareable RDDs across different job submissions.

Key Results

  • Work Reduction: In real-world Spark experiments (Ridge Regression), the adaptive algorithm reduced the total work required to recompute RDDs by 12%.
  • Hit Ratio: In large-scale simulations, the "Adaptive" approach achieved hit ratios of up to 70%, while traditional policies like LRU, FIFO, and LCS (Least Cost Strategy) struggled to exceed 17% under the same cache constraints.
  • Efficiency: The algorithm proved particularly effective as cache size increased, showing a much steeper performance improvement curve than standard policies.

Limitations and Future Work

The current model primarily monitors deterministic operations. Non-deterministic operations (like certain shuffles) might result in different RDDs even with the same logic, making them harder to cache effectively. While the logic is general, the implementation was specific to Apache Spark; extending this to other platforms and studying the overhead at extreme scales are areas for future research.

Summary updated

BibTeX
@inproceedings{yang2018intermediate,
  author = {Zhengyu Yang and Danlin Jia and Stratis Ioannidis and Ningfang Mi and Bo Sheng},
  title = {{Intermediate Data Caching Optimization for Multi-Stage and Parallel Big Data Frameworks}},
  booktitle = {IEEE CLOUD},
  year = {2018},
  doi = {10.1109/cloud.2018.00042},
}
Figure