Introduction
In the era of cloud-native computing, the decoupling of compute and storage has provided theoretically infinite elasticity. However, a persistent challenge remains for data analysts: the "Goldilocks" problem of resource allocation. Currently, users must specify a Degree of Parallelism (DOP) before a SQL query begins. Underestimating leads to missed latency targets, while overestimating results in unnecessary costs. Static performance-cost models often fail due to the dynamic nature of cloud workloads.
Accordion addresses this by introducing Intra-Query Runtime Elasticity (IQRE). It is the first query engine capable of dynamically adjusting a query’s DOP during execution without the need for pausing or restarting. This allows users to start queries with minimal resources and scale up only when real-time metrics indicate a need for more speed.
System Design and Execution Model
Built from the ground up in C++, Accordion adopts a vectorized, push-based execution model similar to Presto, utilizing Apache Arrow for efficient data exchange. To support seamless scaling, the system partitions query plans into discrete stages.
Key architectural innovations include:
- Runtime Elastic Buffer: A self-tuning mechanism that adjusts capacity based on real-time data consumption, preventing downstream "starvation" during parallelism shifts.
- Multi-Level Scaling: Accordion scales at two granularities: intra-task (adding threads/drivers to existing tasks) and intra-stage (spawning new tasks/nodes for a specific stage).
- DOP Switching for Joins: To avoid disruptive re-balancing of distributed hash tables, Accordion employs intermediate data caching. It builds a new hash table in the background and switches the probe side to the new, more parallel task group once ready.
Dynamic Tuning and Prediction
A core component of Accordion is its "What-If" Predictor and automated tuner. By monitoring the progress of "leaf" stages (like table scans), the system can accurately estimate the remaining execution time.
The tuner identifies computational bottlenecks by analyzing exchange buffer throughput. The "What-If" service then calculates how much a DOP increase would reduce the remaining time, allowing for informed manual or automatic resource adjustments. To ensure data integrity during scale-down, Accordion uses an "End Page Relay" protocol, where a special marker signals operators to finish work and shut down gracefully in a bottom-up sequence.
Evaluation and Results
The system was evaluated using the TPC-H benchmark on AWS EC2 clusters.
- Efficiency: Standalone tests (SF1) showed Accordion's baseline performance is competitive with Prestissimo, the high-performance C++ version of Presto.
- Elasticity Gains: On a SF100 (107GB) dataset, intra-task tuning reduced execution time for TPC-H Q3 by 58.42%, while intra-stage tuning achieved a 73.71% reduction.
- Low Overhead: The latency for generating new tasks and drivers is remarkably low, typically under 1ms.
- Predictive Accuracy: The "What-If" predictor demonstrated high precision, with actual completion times falling within seconds of its estimates.
Conclusion and Future Directions
Accordion demonstrates that runtime elasticity is not only possible but highly effective for optimizing cloud-native data analysis. While the current implementation focuses on homogeneous resources and fixed physical plans, future work will explore heterogeneous compute (e.g., GPU integration), dynamic plan modification (e.g., adding shuffle stages mid-query), and deep learning to better capture complex user cost-performance preferences.
Summary updated