CrystalPerf: Learning to Characterize the Performance of Dataflow Computation through Code Analysis

Huangshi Tian, Minchen Yu, Wei WangUSENIX ATC 2021

TL;DR

This paper introduces CrystalPerf, a novel, framework-agnostic tool that uses machine learning on source code to predict the performance of dataflow computations. It addresses the challenge of understanding and optimizing complex dataflow jobs without requiring intrusive code instrumentation, offering accurate performance predictions and bottleneck identification.

What Problem Does This Paper Address?

Modern big data processing relies heavily on dataflow frameworks like Spark, Flink, and TensorFlow, which structure computations as Directed Acyclic Graphs (DAGs). While powerful, these frameworks often suffer from performance issues like resource contention and inefficient configurations. Diagnosing these problems is notoriously difficult due to the complexity of DAG execution and the overwhelming amount of low-level trace data generated by existing tools. Furthermore, many existing performance analysis tools are framework-specific or require modifying the framework's source code, making them brittle and difficult to maintain as frameworks evolve. This paper tackles the need for a general, non-intrusive approach to characterize and predict dataflow job performance.

Methods

CrystalPerf employs a two-stage approach:

  1. DAG Execution Profile Construction: It first extracts execution traces from dataflow jobs, including start/end times and call traces for each operation. It then identifies the source code for these operations.
  2. Performance-Resource Model Learning: This is the core innovation. CrystalPerf uses two pre-trained neural network classifiers to infer the resource usage (CPU, disk, network) of individual functions based on their source code and documentation. This inference is done without code instrumentation.
  3. Code Embedding: A recursive autoencoder is used to create vector representations of function code, capturing syntactic and semantic patterns.
  4. Documentation Embedding: Gated Recurrent Units (GRUs) are used to embed natural language documentation into vectors.
  5. The combined embeddings are fed into neural networks to predict a "resource vector" for each function, indicating the proportion of time spent on each resource.
  6. These function-level resource vectors are then aggregated to form an operation-level resource vector.
  7. Finally, these operation vectors are assembled into a job-level DAG execution profile.

This profile can then be used for debugging (identifying bottlenecks) or for performance prediction under different resource configurations using learned performance-resource models.

Datasets

The paper does not explicitly mention specific large-scale datasets used for training the core neural network classifiers. However, it states that they collected approximately 5,000 low-level functions from five popular open-source libraries (FS2, Twitter Util, Play Framework, Scalaz, and Scala Standard Library) for training. For validation, they collected functions from the Python standard library and OpenJDK. For evaluation, they used standard benchmarking workloads: TPC-H queries for Spark, Yahoo Streaming Benchmark and Dhalion Benchmark for Flink, and ResNet/VGG on the ImageNet dataset for TensorFlow. They also used the Big Data Benchmark (BDB) for comparison with Monotasks.

Key Insights and Ideas

  • Code as a Performance Predictor: The most significant insight is that the source code and documentation of functions contain learnable patterns that accurately reveal their resource usage. This bypasses the need for runtime instrumentation.
  • Framework Agnosticism: By focusing on general DAG structures and leveraging code analysis, CrystalPerf achieves a high degree of framework independence, a major advantage over existing tools.
  • No Code Instrumentation Required: This is a critical practical benefit, simplifying adoption and reducing maintenance overhead compared to methods that modify framework code.
  • Generalizability of ML Models: The neural network classifiers trained on Scala code can accurately predict resource usage in frameworks written in Java and C++, demonstrating strong cross-language and cross-framework generalizability.
  • Resource Vectors for Operations: Representing operation resource usage as a vector of time proportions provides a concise and effective way to capture performance characteristics.

Key Results

  • Performance Prediction Accuracy: CrystalPerf predicts job runtimes with an average deviation of 13.47% across Spark, Flink, and TensorFlow workloads under various resource variations.
  • Comparison with Monotasks: CrystalPerf achieves comparable prediction accuracy to Monotasks (a specialized Spark performance tool) on the Big Data Benchmark, despite Monotasks' intrusive nature and tailored approach.
  • Classifier Robustness: The neural network classifiers are robust to labeling inaccuracies in the training data and generalize well across different programming languages.
  • Case Studies: CrystalPerf effectively helped users identify bottlenecks (e.g., CPU in a Spark job, I/O in a TensorFlow job) and address performance issues, leading to significant runtime improvements (e.g., halving runtime by doubling CPU cores).

Limitations and Future Work

  • Streaming Scenarios: CrystalPerf's ability is limited for streaming applications due to dynamic parallelism changes and varying data arrival rates, which require more complex modeling.
  • Memory Modeling: While CrystalPerf models memory impact, it uses a simplified "reversed roofline model" and acknowledges that other factors like garbage collection could be modeled more comprehensively.
  • Warm-up Effect: While considered, the warm-up effect in simulations is simplified, and the paper notes that users can provide customized schedulers.
  • Future Work: The authors suggest modeling more complicated memory effects and extending the framework to support more dataflow frameworks and resource types. They also mention the potential for users to provide custom performance models.

Summary updated

BibTeX
@inproceedings{tian2021crystalperf,
  author = {Huangshi Tian and Minchen Yu and Wei Wang},
  title = {{CrystalPerf: Learning to Characterize the Performance of Dataflow Computation through Code Analysis}},
  booktitle = {USENIX ATC},
  year = {2021},
  url = {https://openreview.net/forum?id=tXIOTrkJsI},
}

Loading related content...

Figure