ByteDance: Use AI to automatically tune Linux kernel parameters

At the recently held Linux Plumbers Conference, ByteDance Linux kernel engineer Cong Wang  delivered a keynote speech on " Linux Kernel Autotuning ", proposing that artificial intelligence (AI) and machine learning (ML) can be used to adjust the Linux kernel, thereby Optimize performance for specific workloads.

He pointed out that the current Linux kernel provides users with thousands of parameters, so it has become increasingly difficult to adjust parameters for optimal performance. In most cases, different workloads require different tuning of different sets of Linux kernel parameters.

In large data centers like ByteDance, it is almost impossible to manually adjust Linux kernel parameters for hundreds of different workloads. Therefore, ByteDance proposed a solution to try to automate the entire Linux kernel parameter adjustment process with minimal engineering investment.

We also noticed that memory management is one of the Linux kernel subsystems that requires more automatic tuning. With the help of machine learning algorithms such as Bayesian optimization, we believe that automatic tuning can defeat even most Linux kernel engineers. In this talk, we will present how the Linux kernel autotuning solution works and an overview of its design and architecture. We will also look at some specific cases of Linux kernel memory management to present our results as a proof of concept.

For future work, we hope to use this opportunity to propose and discuss an in-kernel machine learning framework that can further this project to fully optimize the Linux kernel fast path in kernel space.

Wang quipped that the move was not about "putting Linux kernel engineers out of work," but rather aimed at freeing human engineers from the work of tweaking the performance of each individual workload while leveraging historical data to make better decisions. Find better solutions than those currently arrived at using trial and error and heuristics.

The autotuning system is designed to automatically adjust the Linux kernel's internal settings based on specific workloads and hardware configurations. This dynamic tuning ensures optimal performance and solves a long-standing problem faced by the Linux community of manually tuning the kernel for specific scenarios.

  • Dynamic optimization: The system continuously monitors kernel performance and makes real-time adjustments to settings such as CPU frequency scaling and memory management.
  • Improved efficiency: By optimizing resource usage, the auto-tuning system greatly improves the efficiency of Linux systems, especially in environments with different workloads.
  • User-Friendly Interface: The system includes a user-friendly interface so that even users with limited technical knowledge can benefit from enhanced core performance.
  • Customizable settings: Advanced users can customize auto-tuning parameters to tailor the system to their specific needs.

Although it is still in the early stages, Byte says it has made some progress. For example, by combining DAMON, a Linux kernel subsystem for memory access monitoring and optimization, with the framework, you can find the best solution for your MySQL application. To do this, they ran different DAMON scenarios and compared their performance and found that they could reduce the application's memory usage by 30%.

In another case, the company optimized HTTP network latency on the NGINX server by adjusting 16 kernel sysctl parameters. In the best case, ML tuning improves NGNIX network performance by 12% compared to expert manual tuning.

Byte doesn't claim that its AI/ML approach is applicable to all Linux tuning efforts, but engineers also said: "Despite limitations, we believe that kernel machine learning is not only possible, but necessary."

The editor of the technology media ZDNet expressed his approval of Byte's move and believed that it could change the rules of the game for Linux applications. "By simplifying kernel optimization, we will make Linux more accessible and more efficient for a wider range of users and applications. In particular, I see the auto-tuning system improving performance in virtually all server, cloud computing and data center applications."

Guess you like

Origin www.oschina.net/news/266922/linux-kernel-ai-bytedance