Table of Contents
Fetching ...

BQSched: A Non-intrusive Scheduler for Batch Concurrent Queries via Reinforcement Learning

Chenhao Xu, Chunyu Chen, Jinglin Peng, Jiannan Wang, Jun Gao

TL;DR

This work tackles batch query scheduling for data pipelines by formulating batch scheduling as a combinatorial, non-intrusive RL problem. It introduces BQSched, which couples an attention-based state representation—built from per-query QueryFormer embeddings and running-state features—with IQ-PPO, an auxiliary-task-enhanced PPO, to learn effective schedules without instrumenting the DBMS. Three optimizations—adaptive masking, scheduling gain-based clustering, and an incremental simulator—address the large action space, complex query interactions, and costly sampling, enabling scalable training and robust performance. Empirical results across multiple benchmarks, DBMSs, and data/query scales show that BQSched substantially reduces makespan and improves stability relative to heuristic baselines and a baseline RL scheduler, with strong adaptability and reduced training costs via simulator pretraining. This approach promises practical gains for enterprise data pipelines by safely accelerating parallel batch workloads without modifying database internals.

Abstract

Most large enterprises build predefined data pipelines and execute them periodically to process operational data using SQL queries for various tasks. A key issue in minimizing the overall makespan of these pipelines is the efficient scheduling of concurrent queries within the pipelines. Existing tools mainly rely on simple heuristic rules due to the difficulty of expressing the complex features and mutual influences of queries. The latest reinforcement learning (RL) based methods have the potential to capture these patterns from feedback, but it is non-trivial to apply them directly due to the large scheduling space, high sampling cost, and poor sample utilization. Motivated by these challenges, we propose BQSched, a non-intrusive Scheduler for Batch concurrent Queries via reinforcement learning. Specifically, BQSched designs an attention-based state representation to capture the complex query patterns, and proposes IQ-PPO, an auxiliary task-enhanced proximal policy optimization (PPO) algorithm, to fully exploit the rich signals of Individual Query completion in logs. Based on the RL framework above, BQSched further introduces three optimization strategies, including adaptive masking to prune the action space, scheduling gain-based query clustering to deal with large query sets, and an incremental simulator to reduce sampling cost. To our knowledge, BQSched is the first non-intrusive batch query scheduler via RL. Extensive experiments show that BQSched can significantly improve the efficiency and stability of batch query scheduling, while also achieving remarkable scalability and adaptability in both data and queries. For example, across all DBMSs and scales tested, BQSched reduces the overall makespan of batch queries on TPC-DS benchmark by an average of 34% and 13%, compared with the commonly used heuristic strategy and the adapted RL-based scheduler, respectively.

BQSched: A Non-intrusive Scheduler for Batch Concurrent Queries via Reinforcement Learning

TL;DR

This work tackles batch query scheduling for data pipelines by formulating batch scheduling as a combinatorial, non-intrusive RL problem. It introduces BQSched, which couples an attention-based state representation—built from per-query QueryFormer embeddings and running-state features—with IQ-PPO, an auxiliary-task-enhanced PPO, to learn effective schedules without instrumenting the DBMS. Three optimizations—adaptive masking, scheduling gain-based clustering, and an incremental simulator—address the large action space, complex query interactions, and costly sampling, enabling scalable training and robust performance. Empirical results across multiple benchmarks, DBMSs, and data/query scales show that BQSched substantially reduces makespan and improves stability relative to heuristic baselines and a baseline RL scheduler, with strong adaptability and reduced training costs via simulator pretraining. This approach promises practical gains for enterprise data pipelines by safely accelerating parallel batch workloads without modifying database internals.

Abstract

Most large enterprises build predefined data pipelines and execute them periodically to process operational data using SQL queries for various tasks. A key issue in minimizing the overall makespan of these pipelines is the efficient scheduling of concurrent queries within the pipelines. Existing tools mainly rely on simple heuristic rules due to the difficulty of expressing the complex features and mutual influences of queries. The latest reinforcement learning (RL) based methods have the potential to capture these patterns from feedback, but it is non-trivial to apply them directly due to the large scheduling space, high sampling cost, and poor sample utilization. Motivated by these challenges, we propose BQSched, a non-intrusive Scheduler for Batch concurrent Queries via reinforcement learning. Specifically, BQSched designs an attention-based state representation to capture the complex query patterns, and proposes IQ-PPO, an auxiliary task-enhanced proximal policy optimization (PPO) algorithm, to fully exploit the rich signals of Individual Query completion in logs. Based on the RL framework above, BQSched further introduces three optimization strategies, including adaptive masking to prune the action space, scheduling gain-based query clustering to deal with large query sets, and an incremental simulator to reduce sampling cost. To our knowledge, BQSched is the first non-intrusive batch query scheduler via RL. Extensive experiments show that BQSched can significantly improve the efficiency and stability of batch query scheduling, while also achieving remarkable scalability and adaptability in both data and queries. For example, across all DBMSs and scales tested, BQSched reduces the overall makespan of batch queries on TPC-DS benchmark by an average of 34% and 13%, compared with the commonly used heuristic strategy and the adapted RL-based scheduler, respectively.
Paper Structure (18 sections, 15 equations, 9 figures, 3 tables, 1 algorithm)

This paper contains 18 sections, 15 equations, 9 figures, 3 tables, 1 algorithm.

Figures (9)

  • Figure 1: BQSched system overview.
  • Figure 2: RL-based query scheduler.
  • Figure 3: An example of adaptive masking.
  • Figure 4: Scheduling on query clusters.
  • Figure 5: Scalability on TPC-DS and TPC-H with DBMS-X and Z.
  • ...and 4 more figures