Abstract
Developing modern systems software is a complex task that combines business logic programming and Software Performance Engineering (SPE). The later is an experimental and labor-intensive activity focused on optimizing the system for a given hardware, software, and workload (hw/sw/wl) context. Today's SPE is performed during build/release phases by specialized teams, and cursed by: 1) lack of standardized and automated tools, 2) significant repeated work as hw/sw/wl context changes, 3) fragility induced by a "one-size-fit-all" tuning (where improvements on one workload or component may impact others). The net result: despite costly investments, system software is often outside its optimal operating point - anecdotally leaving 30% to 40% of performance on the table. The recent developments in Data Science (DS) hints at an opportunity: combining DS tooling and methodologies with a new developer experience to transform the practice of SPE. In this paper we present: MLOS, an ML-powered infrastructure and methodology to democratize and automate Software Performance Engineering. MLOS enables continuous, instance-level, robust, and trackable systems optimization. MLOS is being developed and employed within Microsoft to optimize SQL Server performance. Early results indicated that component-level optimizations can lead to 20%-90% improvements when custom-tuning for a specific hw/sw/wl, hinting at a significant opportunity. However, several research challenges remain that will require community involvement. To this end, we are in the process of open-sourcing the MLOS core infrastructure, and we are engaging with academic institutions to create an educational program around Software 2.0 and MLOS ideas.
Introduction
Software Performance Engineering (SPE) has traditionally been a manual, labor-intensive process—often described as a "dark art"—where engineers tune "magic numbers" like buffer sizes and spinlock counts to optimize performance for specific hardware. This approach suffers from three primary hurdles: a lack of standardized tools for exploring massive parameter spaces, significant repeated effort when hardware or workloads shift, and the fragility of "one-size-fits-all" tuning that may optimize for one scenario while degrading another.
MLOS addresses these challenges by treating system tuning as a data science problem. By decoupling performance tuning from core business logic, it transforms SPE from a static build-time activity into a continuous, automated process.
System Architecture and Methodology
The core philosophy of MLOS is the decoupling of tuning parameters from the system's source code. Instead of hard-coding constants (e.g., int pageSize = 4096;), developers use MLOS hooks (e.g., mlos.get("pagesize")) to register tunable parameters.
As shown in the architecture diagram below, the system consists of three primary components:
- The Target System: The software being optimized (e.g., SQL Server), which includes hooks for parameters and observations for metrics like latency or throughput.
- The MLOS Agent: An external daemon that hosts machine learning models (such as Bayesian Optimization) to conduct experiments and determine optimal configurations.
- Shared Memory Channel: A high-performance, low-latency communication layer that passes tuning commands and telemetry between the target system and the agent, minimizing the "observer effect" on performance.
Additionally, the Resource Performance Interface (RPI) allows developers to define performance constraints (e.g., memory or CPU limits), enabling the MLOS agent to find the best configuration within a specific "resource envelope."
Experimental Evaluation
MLOS was evaluated by tuning critical components of Microsoft SQL Server, including hash tables and spinlocks. Unlike static datasets, MLOS utilizes active experimentation to generate data in real-time.
Key findings include:
- Performance Gains: Component-level optimizations yielded improvements of 20% to 90% over default, manually-tuned parameters.
- Resource Efficiency: MLOS identified diminishing returns in memory allocation for hash tables, allowing for significant RAM savings without sacrificing throughput.
- Workload Adaptation: For spinlocks, the system demonstrated that optimal configurations vary significantly based on thread count and workload, proving that static tuning is inherently sub-optimal.
Conclusion and Future Work
MLOS demonstrates that integrating data science methodologies into systems engineering can reclaim significant performance typically lost to static tuning. While successful at the component level, scaling this to thousands of interacting parameters across an entire database engine remains an open research challenge. Microsoft is currently open-sourcing the MLOS core infrastructure and collaborating with academic institutions to advance the principles of "Software 2.0."
Summary updated