Introduction
In modern cloud computing environments, a single database instance often serves dozens of disparate applications or microservices. This consolidation leads to a "mixed log" problem: the database receives a chaotic, interleaved stream of SQL queries from multiple sources. For Database Administrators (DBAs), this makes it nearly impossible to reconstruct the underlying business logic or identify recurring patterns for optimization. Traditional workload analysis tools typically assume a single, clean stream of logic and fail to scale to the complexity of industrial cloud workloads. Furthermore, privacy restrictions often prevent DBAs from accessing the original application source code, leaving them "blind" to the relationships between queries.
The Alibaba Workload Miner (AWM) Framework
To address these challenges, we present the Alibaba Workload Miner (AWM), a real-time system designed to untangle massive SQL query streams. AWM operates through four specialized modules that bridge the gap between raw query logs and actionable business insights.
1. Data Collection & Preprocessing (DCPM)
AWM treats SQL as a semantic language. It utilizes pre-trained Foundation Models (FMs), such as BERT, to generate high-dimensional semantic embeddings of SQL queries. By combining these embeddings with execution features—such as response time and rows examined—AWM creates a holistic "fingerprint" for every query, allowing it to understand intent even when syntax varies.
2. Offline Training (OTM)
To maintain data privacy, AWM employs a novel labeling method. Users provide unique IDs for business groups without exposing sensitive code. These labels are used to train an XGBoost classifier that can recognize and categorize business groups in real-time.
3. Online Workload Mining (OWMM)
This real-time engine classifies incoming queries into their respective business groups. Once separated, AWM uses Markov Chains, guided by the Minimum Description Length (MDL) principle, to identify frequent sequences or "patterns" of queries within those groups. This "classify first, then mine" approach significantly improves the accuracy of pattern discovery compared to mining the entire interleaved log.
4. Pattern-based Optimizing (POM)
Once a pattern is identified, AWM constructs a Dependency Graph. By detecting queries within a pattern that have no data dependencies on one another, the system suggests parallelization strategies. This allows the database to execute independent queries concurrently rather than sequentially, reducing overall latency.
Experimental Evaluation
AWM was evaluated using three primary datasets: AQL-N (a standard Alibaba Cloud log), AQL-L (a large-scale industrial log with 4.5 million queries), and OSQL (a synthetic dataset mixing multiple public sources to simulate extreme complexity).
Key Results
- Accuracy: AWM improved pattern discovery accuracy by 66% over state-of-the-art baselines like Oracle’s Workload Intelligence (WI).
- Efficiency: The system achieved a 22% reduction in online inference latency, making it suitable for high-throughput production environments.
- Performance Gains: In real-world use cases, AWM-suggested optimizations reduced average query execution time by 2.7x and significantly stabilized execution jitter.
- Scalability: The classification models can be trained on millions of queries in just a few hundred seconds.
Conclusion and Future Work
Alibaba Workload Miner demonstrates that combining NLP foundation models with traditional Markov-chain mining can effectively untangle complex database workloads. While the system provides significant speedups, future work will focus on reducing the overhead of large foundation models and detecting "business-based" dependencies that are not explicitly reflected in SQL syntax. Additionally, these patterns hold promise for automated anomaly detection and root-cause analysis in cloud databases.
Summary updated