NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Optimal Resource Allocation for Serverless Queries

Anish Pimpley, Shuo Li, Anubha Srivastava, Vishal Rohra, Yi Zhu, Soundararajan Srinivasan, Alekh Jindal, Hiren Patel, Shi Qiao, Rathijit SenarXiv 2021

Introduction

In modern serverless big-data ecosystems, such as Microsoft’s SCOPE, Amazon Athena, and Google BigQuery, resources are dynamically allocated on a per-query basis. While this model offers immense scalability, it places the burden of resource estimation on the user. Evidence suggests that users are generally poor at estimating the "tokens" (containers or resource units) required for a job. This leads to a pervasive issue of over-allocation, where resources are reserved but remain idle, incurring unnecessary costs and reducing overall cluster throughput.

The Problem: Resource Over-allocation

The primary driver of inefficiency is the discrepancy between allocated resources and actual utilization. Users often default to standard settings or allocate for the absolute peak usage observed in previous runs. However, analytical queries typically exhibit "peaky" resource skylines with significant "valleys" where demand is low.

Resource over-allocation in serverless queries.

As illustrated in Figure 1, the gap between the "Default Allocation" and the actual resource usage represents a massive waste of capacity. Even "Peak Allocation" is often excessive because those peak resources might only be required for a small fraction of the query's total execution time.

The TASQ Framework

To address this, we present TASQ (Token Allocation for Serverless Queries), a machine-learning pipeline designed to predict the optimal resource allocation for both recurring and novel serverless analytical queries. TASQ shifts the paradigm from predicting a single resource value to modeling the entire Performance Characteristic Curve (PCC).

1. Performance Characteristic Curves (PCC)

The relationship between allocated tokens and job runtime is non-linear and follows the law of diminishing returns. TASQ models this relationship using a power-law constraint: $Runtime = b \times Tokens^a$. By predicting the parameters $a$ and $b$ rather than raw runtime points, the model ensures physical plausibility—specifically, that increasing resources will never result in a slower predicted runtime.

The Performance Characteristic Curve (PCC) modeling the trade-off between tokens and runtime.

Figure 2 demonstrates how this curve allows users (or automated systems) to visualize the trade-off. A small reduction in tokens might have a negligible impact on runtime, while further reductions lead to a sharp increase in execution time.

2. AREPAS: Area Preserving Allocation Simulator

A significant hurdle in training such models is the "sparsity" of historical data; most jobs are only ever run with a single allocation level. To overcome this, we developed AREPAS, a lightweight simulator. AREPAS operates on the principle that the total "work" (the area under the resource usage timeline) remains roughly constant. When available tokens are capped, AREPAS "stretches" the timeline to maintain this area, providing a high-fidelity synthetic ground truth for how a job would perform under various constraints.

3. Graph Neural Networks (GNNs) for Query Structure

Unlike traditional models that rely on aggregated features, TASQ employs Graph Neural Networks to process the Directed Acyclic Graph (DAG) of query operators. This allows the model to capture the complex structural dependencies, bottlenecks, and data flow patterns inherent in analytical workloads, leading to more accurate predictions for complex or unfamiliar queries.

Key Results and Impact

Evaluation on a production workload of 85,000 anonymized SCOPE jobs from Microsoft clusters yielded several critical insights:

  • Simulator Fidelity: AREPAS achieved a median error of only 9.2% compared to real-world re-executions, validating its use for data augmentation.
  • Efficiency Gains: Analysis revealed that 50% of jobs could have utilized significantly fewer resources with zero impact on performance. Furthermore, if users were willing to accept a marginal 5% performance degradation, 92% of jobs could be run with substantially reduced resource footprints.
  • Model Performance: The GNN-based approach outperformed traditional models like XGBoost in capturing the "trend" of the PCC, ensuring reliable trade-off analysis across the entire allocation spectrum.

Conclusion

TASQ demonstrates that by combining structural query analysis with constrained machine learning and intelligent simulation, serverless platforms can move toward a more efficient, "zero-touch" resource management model. Future work will focus on integrating these curves into automated schedulers that balance cost and performance without requiring manual user intervention.

Summary updated

BibTeX
@misc{pimpley2021optimal,
  author = {Anish Pimpley and Shuo Li and Anubha Srivastava and Vishal Rohra and Yi Zhu and Soundararajan Srinivasan and Alekh Jindal and Hiren Patel and Shi Qiao and Rathijit Sen},
  title = {{Optimal Resource Allocation for Serverless Queries}},
  year = {2021},
  eprint = {2107.08594},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2107.08594},
}
Figure