Skip to main content
QUICK REVIEW

[Paper Review] Cuttlefish: A Lightweight Primitive for Adaptive Query Processing

Tomer Kaftan, Magdalena Bałazińska|arXiv (Cornell University)|Feb 26, 2018
Advanced Bandit Algorithms ResearchDecision Sciences59 references11 citations
TL;DR

Cuttlefish is a lightweight, adaptive query processing primitive that uses Thompson sampling multi-armed bandits to dynamically select the fastest physical operator variants during query execution in Apache Spark. It achieves up to 7.5× throughput improvement over Spark SQL’s optimizer and reaches 72–99% of oracle performance even when suboptimal operators are up to 105× slower.

ABSTRACT

Modern data processing applications execute increasingly sophisticated analysis that requires operations beyond traditional relational algebra. As a result, operators in query plans grow in diversity and complexity. Designing query optimizer rules and cost models to choose physical operators for all of these novel logical operators is impractical. To address this challenge, we develop Cuttlefish, a new primitive for adaptively processing online query plans that explores candidate physical operator instances during query execution and exploits the fastest ones using multi-armed bandit reinforcement learning techniques. We prototype Cuttlefish in Apache Spark and adaptively choose operators for image convolution, regular expression matching, and relational joins. Our experiments show Cuttlefish-based adaptive convolution and regular expression operators can reach 72-99% of the throughput of an all-knowing oracle that always selects the optimal algorithm, even when individual physical operators are up to 105x slower than the optimal. Additionally, Cuttlefish achieves join throughput improvements of up to 7.5x compared with Spark SQL's query optimizer.

Motivation & Objective

  • Address the challenge of selecting optimal physical operator implementations for diverse, complex, and evolving data processing workloads.
  • Overcome the impracticality of manually designing cost models and optimization rules for every new operator in modern data processing frameworks.
  • Enable automatic, online tuning of physical operators without requiring manual hyperparameter tuning or explicit rules.
  • Support distributed, shared-nothing environments while maintaining low runtime overhead and scalability.
  • Enable contextual tuning by learning how operator performance varies with data properties and workload characteristics.

Proposed method

  • Introduces Cuttlefish as a general-purpose primitive for adaptive query processing that operates at the level of individual physical operator variants.
  • Employs Thompson sampling, a Bayesian multi-armed bandit algorithm, to balance exploration and exploitation of different physical operator implementations during query execution.
  • Supports both non-contextual and contextual bandit learning, where the algorithm learns cost models based on input data properties to guide selection.
  • Designs the tuner to be computationally lightweight and efficient, minimizing runtime overhead even in distributed, shared-nothing clusters.
  • Enables cross-machine learning by sharing bandit learning statistics across nodes in a cluster, improving convergence and adaptation speed.
  • Integrates seamlessly into Apache Spark, allowing adaptive tuning of operators such as image convolution, regular expression matching, and relational joins.

Experimental results

Research questions

  • RQ1Can a lightweight, general-purpose primitive be designed to automatically select the fastest physical operator variant during query execution without requiring manual rule or cost model engineering?
  • RQ2How effective is Thompson sampling-based bandit learning in dynamically selecting optimal operator implementations across diverse workloads and hardware configurations?
  • RQ3To what extent can adaptive tuning improve throughput compared to static query optimizers like Spark SQL’s, especially under dynamic or unpredictable workloads?
  • RQ4Can the system learn and exploit contextual cost models that predict performance based on input data characteristics?
  • RQ5How does the approach scale in distributed, shared-nothing environments, and what overhead does it introduce?

Key findings

  • Cuttlefish-based adaptive operators achieve 72–99% of the throughput of an all-knowing oracle that always selects the optimal algorithm, even when suboptimal implementations are up to 105× slower.
  • The system improves join throughput by up to 7.5× compared to Spark SQL’s default query optimizer, demonstrating significant performance gains in real-world workloads.
  • Thompson sampling enables effective exploration-exploitation trade-offs without requiring manual tuning of hyperparameters, making the approach practical for diverse operators.
  • The adaptive tuning mechanism scales efficiently in distributed shared-nothing environments, with minimal runtime overhead and effective cross-machine learning.
  • Contextual bandit learning allows the system to model how operator performance varies with data properties, enabling smarter, data-aware physical operator selection.
  • Cuttlefish outperforms prior online autotuners like SiblingRivalry and REX by supporting distributed execution, avoiding speculative resource waste, and enabling cross-node learning.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.