Starling: A Scalable Query Engine on Cloud Function Services

Matthew Perron, Raul Castro Fernandez, David J. DeWitt, Samuel Madden

TL;DR

This paper introduces Starling, a novel query engine for cloud function services (like AWS Lambda) that offers interactive query performance at a lower cost than traditional provisioned systems, especially for ad-hoc, low-to-moderate volume analytics workloads. It tackles the challenges of stateless, resource-constrained cloud functions by employing techniques for efficient data shuffling, straggler mitigation, and cost-performance tuning.

What Problem Does This Paper Address?

Modern organizations increasingly rely on cloud services for data analytics. The common approach is to provision dedicated clusters of compute nodes, which often leads to underutilization and wasted costs for bursty or low-volume workloads. While cloud function services (FaaS) offer a compelling "pay-per-use" model and massive parallelism, they present unique challenges for complex analytical queries: limited execution time, small memory footprints, and the inability of functions to communicate directly. Furthermore, traditional systems often require data to be loaded into proprietary formats, adding latency for ad-hoc queries on raw data stored in cost-effective cloud object storage. This paper addresses the gap for a system that provides interactive query performance, low cost, and flexibility for ad-hoc analytics directly on cloud object storage, without the need for pre-provisioning or data loading.

Methods

Starling is a query execution engine built on cloud function services. Its core components include:

  • Coordinator: Compiles queries, uploads executables to the cloud function service, and schedules tasks. It's designed to run on a small virtual machine.
  • Workers (Function Invocations): Each worker executes a part of the query plan. They are stateless and communicate via a shared medium.
  • Cloud Object Storage (AWS S3): Used for both storing base table data and as the communication medium for intermediate results. Starling leverages S3's on-demand elasticity and cost-effectiveness.
  • Data Shuffling Strategies:
    • Standard Shuffle: For smaller joins, where consumers read from every producer.
  • Multistage Shuffle: For larger joins, introducing combining tasks to reduce the number of S3 requests and associated costs.
  • Straggler Mitigation:
    • Read Straggler Mitigation (RSM): Detects slow S3 reads and retries them on a new connection.
  • Write Straggler Mitigation (WSM): Similar to RSM but adapted for S3 writes, which are often larger.
  • Pipelining: Allows downstream stages to start processing data as soon as it's available from upstream stages, reducing overall query latency.
  • Tunable Performance: Users can adjust the number of tasks per stage to trade off cost and performance.

Datasets

The primary dataset used for evaluation is the TPC-H benchmark dataset. Experiments were conducted on:

  • A scale factor 1,000 (1TB) dataset.
  • A scale factor 10,000 (10TB) dataset for scalability testing.

The data was stored in Apache ORC format with Snappy compression, broken into files of at most 1GB, and uploaded to Amazon S3.

Key Insights and Ideas

  • Cloud Functions as a Viable Analytics Platform: The paper demonstrates that despite their limitations, cloud functions can be effectively used for complex analytical queries with appropriate architectural design and mitigation strategies.
  • S3 as a Flexible Communication Medium: Leveraging S3 for intermediate data shuffling, while having higher latency than in-memory solutions, proves to be a cost-effective and scalable approach for stateless cloud functions.
  • The Importance of Straggler Mitigation: S3's variable tail latency is a significant bottleneck. Starling's RSM and WSM techniques are crucial for achieving predictable performance and reducing query latency.
  • Cost-Performance Tuning is Key: The ability for users to tune the number of tasks per stage allows for flexible optimization based on specific query needs and budget constraints.
  • "Serverless" Analytics is Not Just About No Servers: It's about a fundamentally different operational model (pay-per-use, elastic scaling) that can be more cost-effective for certain workloads than traditional provisioned infrastructure.

Key Results

  • Cost Efficiency: On a 1TB TPC-H dataset, Starling is less expensive than provisioned systems for workloads with queries arriving 1 minute apart or more. For moderate query rates, it's the least expensive system among those tested.
  • Performance: Starling achieves query latency comparable to provisioned systems, and lower latency than competing systems reading directly from cloud object stores.
  • Scalability: Starling scales to larger datasets (10TB) without expensive reprovisioning, showing significantly lower latency than provisioned systems at that scale.
  • Straggler Mitigation Impact: Read straggler mitigation (RSM) reduced tail latency by over 4x (from >1 second to 0.25 seconds at the 99.99th percentile). Write straggler mitigation (WSM) reduced worst-case write times from over 20 seconds to about 10 seconds.
  • Tunable Performance: For TPC-H Query 12, Starling could achieve a 6x performance improvement over its unoptimized version by enabling optimizations incrementally.

Limitations and Future Work

  • No Query Optimizer: Starling currently relies on pre-planned queries and does not have its own query optimizer. This means users need to provide optimized plans, potentially by using external tools like the Redshift optimizer.
  • Coordinator Bottleneck: For very high concurrency, the coordinator can become a bottleneck.
  • Straggler Mitigation Assumptions: The straggler mitigation strategies are based on observed behavior and theoretical frameworks, as the internal workings of S3 are opaque.
  • Future Work: The authors suggest optimizing the coordinator for high concurrency and exploring more sophisticated query optimization techniques. They also note that while Starling is cost-competitive, further analysis from a cloud provider's perspective could reveal even greater efficiencies.

Summary updated

BibTeX
@inproceedings{perron2020starling,
  author = {Matthew Perron and Raul Castro Fernandez and David J. DeWitt and Samuel Madden},
  title = {{Starling: A Scalable Query Engine on Cloud Function Services}},
  booktitle = {SIGMOD},
  year = {2020},
  doi = {10.1145/3318464.3380609},
}
Figure