Using A-Tune on openEuler
What Is A-Tune
A-Tune is an AI-based OS performance tuning engine. It leverages AI technologies to enable the OS to understand services, simplify IT system tuning, and deliver excellent performance for applications. This project helps developers get familiar with the A-Tune offline dynamic tuning process to tune an application.
openEuler 20.03 LTS SP1 is used to install A-Tune from source code as follows:
- Install the dependent system software packages.
yum install -y golang-bin python3 perf sysstat hwloc-gui
- Install the Python dependencies.
# Dependencies of the A-Tune service yum install -y python3-dict2xml python3-flask-restful python3-pandas python3-scikit-optimize python3-xgboost python3-pyyaml # Database dependencies yum install -y python3-sqlalchemy python3-cryptography yum install -y python3-psycopg2
- Download and compile the A-Tune source code, and then install A-Tune.
git clone https://gitee.com/openeuler/A-Tune.git cd A-Tune make models make make collector-install make install
Configuring the A-Tune Service
Change the values of network and disk in the /etc/atuned/atuned.cnf file to the specified network adapter and disk.
Managing the A-Tune Service
Load and start the atuned and atune-engine services.
systemctl daemon-reload systemctl start atuned systemctl start atune-engine
NOTE: It takes some time to run the three commands, and no output is displayed. If the system is restarted, restart the services.
Check the status of the atuned and atune-engine services.
systemctl status atuned systemctl status atune-engine
Using the atune-adm CLI
- The list command is used to list the profiles supported by the system and the profiles in the active status.
- The profile command is used to activate a profile.
atune-adm profile web-nginx-http-long-connection
The preceding command activates the profile configuration of web-nginx-http-long-connection.
- The analysis command is used for online static tuning. It collects system information in real time, identifies load types, and automatically optimizes them.
atune-adm analysis [OPTIONS]
- The tuning command is used for offline dynamic tuning. It uses the specified project file to search the dynamic space for the selected parameters to find the optimal solution under the current environment configuration.
atune-adm tuning [OPTIONS] <PROJECT_YAML>
Offline dynamic tuning is the focus of this project.
A-Tune Offline Tuning Case
The following describes how to optimize the GCC compiler. This case can be found in the A-Tune/examples/tuning directory.
- Set up the environment.
- Download stream.c, a memory bandwidth test program.
- Tune the GCC compiler.
atune-adm tuning --project gcc_compile --detail gcc_compile_client.yaml
The memory bandwidth is increased by 121%, and the size of the executable file after compilation is reduced by 17%.
- Save the result.
atune-adm tuning --restore --project gcc_compile
There is no output.
Performing A-Tune Offline Tuning
Offline dynamic tuning involves three input files: client.yaml, server.yaml, and benchmark.
- client.yaml: file stored on the client, including tuning evaluation indicators.
- server.yaml: file stored on the server, including adjustable parameters for tuning.
- benchmark: file stored on the client. You can run this file to obtain the benchmark values of the evaluation indicators.
The following uses GCC offline dynamic tuning as an example to describe the three files.
The parameters in the preceding picture are as follows:
- Tuning algorithm (line 2)
- Number of iterations (line 3)
- Number of random iterations (line 4)
- Benchmark execution command (line 6)
- Information about evaluation indicator 1 (lines 8 to 13)
- Information about evaluation indicator 2 (lines 14 - end)
In addition, you can add parameter selection to the client.yaml file.
Parameter selection is performed before offline dynamic tuning to reduce the parameter space. It selects the parameters that have the greatest impact on performance from the provided parameter space for tuning.
To implement parameter selection, add the following parameters to the client.yaml file:
- feature_filter_engine: parameter selection algorithm
- feature_filter_cycle: number of parameter selection cycles
- feature_filter_iters: number of parameter selection iterations
- feature_filter_count: parameter(s) selected in each cycle
- split_count: number of parameters evenly selected from the value range of tuning parameters
- Application startup command (line 3)
- Command for stopping the application (line 4)
- Adjustable parameters (lines 5 - end)
The benchmark file is used to execute the commands provided in the client.yaml file during performance tuning.
Tuning and Result Saving
atune-adm tuning --project <PROJECT_NAME> --detail <client.yaml>
Save the result:
atune-adm tuning --restore --project <PROJECT_NAME>