TL;DR
This paper investigates the crucial question of when and how to allocate memory for in-memory data processing in distributed systems like Spark and Flink. The authors argue that simply allocating maximum memory for in-memory processing isn't always the most cost-efficient approach, and they propose requirements for smarter, automated resource allocation solutions.
What Problem Does This Paper Address?
Modern data analytics relies heavily on distributed systems like Apache Spark and Apache Flink, which excel at processing massive datasets in parallel, often leveraging in-memory computation for speed. However, a significant challenge lies in determining the optimal amount of cluster resources, particularly memory, to allocate for these jobs. Over-allocating memory can lead to wasted resources and increased costs, especially in cloud environments. Conversely, under-allocating can force data to be spilled to disk, drastically slowing down processing and negating the benefits of in-memory frameworks. This paper tackles the problem of efficient resource allocation, specifically focusing on the trade-offs between in-memory and on-disk processing, aiming to guide the development of automated solutions that avoid costly trial-and-error or complex, pre-trained models.
Methods
The authors employ a problem analysis approach, drawing insights from a publicly available trace dataset of Spark and Hadoop MapReduce executions. They analyze the relationship between resource allocation (specifically memory and CPU cores) and job performance (runtime and cost). Their methodology involves:
- Trace Data Analysis: Examining real-world execution traces to understand how different resource configurations impact job efficiency.
- Problem Formulation: Defining research questions around when in-memory processing is resource-efficient and how to design automated allocation approaches.
- Constraint Definition: Limiting the scope to distributed batch processing, static resource configurations, and focusing on memory, CPU, and scale-out.
They don't introduce a new algorithm for allocation but rather analyze existing patterns to derive requirements for future solutions.
Datasets
The paper utilizes a publicly available trace dataset introduced by Hsu et al. in Arrow [7]. This dataset contains 1031 unique Spark and Hadoop MapReduce executions facilitated by Intel's HiBench benchmarking tool. Each job was run with two different dataset sizes across 69 different AWS cluster configurations, varying in scale-out (4 to 48 VMs) and instance types (c, m, and r classes in large, xlarge, and 2xlarge sizes). The authors do not introduce new benchmarks but leverage existing ones to analyze performance.
Key Insights and Ideas
- In-memory isn't always king: Simply aiming for full in-memory processing isn't always the most cost-effective strategy. Sometimes, graceful on-disk processing can be more economical, especially when the cost of additional memory outweighs the performance gains.
- The memory-CPU trade-off is complex: The efficiency of memory allocation is intertwined with CPU allocation. Adding more CPU cores can sometimes improve performance (e.g., by speeding up disk I/O) even when memory is not fully utilized for caching.
- VM bundling complicates things: In cloud environments, resources are often bundled into VMs. This means that to get more of one resource (like memory), you might be forced to acquire more of another (like CPU cores), potentially leading to underutilization and reduced overall efficiency.
- Cost-effectiveness is key: The most cost-effective resource configuration is also often resource-efficient. This configuration can serve as a baseline for further optimization by adding resources that provide the most performance acceleration at the lowest additional cost.
- Beyond simple profiling: While lightweight profiling can estimate memory needs for in-memory processing, it doesn't inherently tell you if that in-memory processing is worth the cost compared to other resource allocations.
Key Results
The paper presents qualitative findings and observations derived from the trace data analysis:
- Observation 1 (On-Disk vs. In-Memory): For jobs like Logistic Regression and Join, there's a clear point where increasing cluster RAM shifts processing from disk to memory. For example, a Join job with a 188 GB dataset reached full in-memory processing around 300 GB of total cluster RAM.
- Observation 2 (Cost-Effectiveness): For Logistic Regression, the cost optimum was around 120 GB of RAM. For Join, the cost optimum was near the lowest memory and CPU allocation, even with limited in-memory caching.
- Figure 1 Analysis: Illustrates the cost-performance trade-off for a Spark join job, showing how different AWS instance types and cluster sizes impact cost and runtime. It highlights that the cheapest configurations aren't always the most efficient, and vice-versa.
- Figure 2 Analysis: Demonstrates how dataset size impacts the memory threshold for cost-optimal processing in K-Means. Larger datasets require more memory to achieve cost-optimal in-memory processing.
- Figure 3 Analysis: Visually contrasts cost-optimal in-memory processing with cost-optimal on-disk processing for different jobs and datasets, reinforcing the idea that the optimal strategy varies.
Limitations and Future Work
Limitations:
- Static Configuration: The study focuses on static resource configurations and does not explore dynamic, runtime adjustments.
- Limited Resource Types: While memory and CPU are central, the analysis is constrained to these and scale-out, not exploring all possible resource types.
- VM Bundling Impact: The paper acknowledges that VM bundling in public clouds can force suboptimal resource combinations, a factor that complicates allocation.
Future Work:
The authors emphasize the need for automated resource allocation solutions that:
- Do not rely on costly, pre-trained models.
- Can efficiently gather necessary information, potentially through lightweight profiling and reusing learned behaviors.
- Can adapt to changing execution contexts (e.g., new hardware, different job inputs).
- Can automatically evaluate memory requirements and the scaling behavior of jobs.
- Can intelligently balance the cost of memory for in-memory processing against the cost of other resources like CPU.
Summary updated