Introduction
Modern Database Management Systems (DBMS) like PostgreSQL and MySQL feature hundreds of configuration parameters, or "knobs," that significantly impact performance. Traditionally, tuning these knobs has been a manual task for Database Administrators (DBAs). However, the scale of cloud-based deployments and the dynamic nature of modern workloads—where traffic patterns shift between read-heavy and write-heavy operations—render manual tuning impractical. This paper presents an adaptive system that leverages Reinforcement Learning (RL) and a multi-model repository to automate database tuning for evolving workloads.
System Architecture
The proposed system is built upon the Deep Deterministic Policy Gradient (DDPG) algorithm, which is well-suited for the continuous action spaces inherent in database knob settings. Unlike previous approaches that rely on a single static model, this architecture introduces a Multi-Model Repository.
The system consists of a central Tuner that interacts with the target DBMS. When a workload shift is detected, the Tuner can either retrieve a specialized model from the repository that matches the current workload characteristics or initialize a new model if no suitable match exists. This prevents the "confused agent" problem, where a single model's performance degrades as it attempts to reconcile conflicting experiences from different workload types.
Workload Fingerprinting and Adaptation
To enable rapid adaptation, the system must accurately identify the current workload. The authors employ Workload Fingerprinting using an autoencoder neural network.
The autoencoder compresses 25 internal database metrics (e.g., throughput, latency, and background writer statistics) into a 3-dimensional "workload representation vector." By calculating the cosine similarity between the current vector and those associated with stored models, the system can efficiently select the most relevant pre-trained agent from the repository.
Optimized Learning and Reward Function
Stability in online learning is achieved through two key modifications to the standard RL framework:
- Simplified Reward Function: The reward is calculated based on performance relative to a fixed default baseline rather than the immediate previous state. By setting the discount factor ($\gamma$) to zero, the authors eliminated the instability caused by predicting future rewards in noisy, non-deterministic database environments.
- Prioritized Replay Buffer: To accelerate training, the system uses a buffer that prioritizes past experiences with higher temporal difference (TD) errors, ensuring the agent learns more effectively from high-value samples.
Experimental Results
The system was evaluated on PostgreSQL using Sysbench to simulate varied Online Transactional Processing (OLTP) workloads. Key findings include:
- Throughput Gains: The system achieved a 2x improvement over default settings for mixed Read/Write workloads and a 5x improvement for Write-Only workloads.
- Latency Reduction: Offline training sessions demonstrated up to an 8x reduction in latency compared to the baseline.
- Robustness: In scenarios with alternating workloads (switching between R/W and W/O every hour), the multi-model approach maintained stable, high performance, while single-model baselines suffered significant performance crashes due to conflicting training data.
Conclusion
This research demonstrates that a multi-model RL approach effectively addresses the challenges of online database tuning for dynamic workloads. By combining workload fingerprinting with a repository of specialized agents, the system achieves significant performance gains and stability. Future work will focus on extending the system to handle complex analytical (OLAP) workloads and investigating strategies to manage the potential growth of the model repository.
Summary updated