Overall Process
This section describes how to use the AutoTuner throughout the process from obtaining a template to applying the result. (The following uses PostgreSQL as an example.)
- Obtain the template file.
Select a configuration template file for the application that you want to run.
1devkit kat template -g -o /opt/template
The -g parameter displays the interactive user interface. Set the basic parameters required by a template file. The -o /opt/template parameter indicates the path to the generated template file.
- (Optional) Convert a simple template file to a general template file.
If a simple parameter template does not meet your requirements, convert it to a general parameter template.
1devkit kat template -c /opt/template/template_xxxx/task_xxxx_xxx.json
Command output:
1[2024-12-19 13:53:27 UTC] [KAT] [ info ] - /opt/template/template_xxxx/task_Postgresql.json has been converted to /opt/template/template_xxxx/task_Postgresql_custom.json
Figure 1 General template file
- Set mandatory parameters in the template file.
Set the blank parameters in the template file based on your requirements.
Figure 2 Setting template parameters
- Enable automatic tuning.
Use the completed simple template file to start automatic tuning.
1devkit kat train -t /opt/template/template_xxxx/task_Postgresql.json -p /opt/template/template_xxxx/param_Postgresql.json
The task parameters have been configured in the task_Postgresql.json file and the application parameters have been configured in the param_Postgresql.json file.
Command output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
[2024-12-31 08:15:58 UTC] [KAT] [message] - Create work space /opt/template/template_xxxx/train-20241231-161557 [2024-12-31 08:16:09 UTC] [KAT] [message] - Application : Postgresql [2024-12-31 08:16:09 UTC] [KAT] [message] - Tuning Direction : high [2024-12-31 08:16:09 UTC] [KAT] [message] - ================================================================================ [2024-12-31 08:16:09 UTC] [KAT] [message] - Kunpeng Auto Tuner - task set up [2024-12-31 08:16:09 UTC] [KAT] [message] - start time: 2024-12-31 08:16:09 [2024-12-31 08:16:09 UTC] [KAT] [message] - -------------------------------------------------------------------------------- [2024-12-31 08:16:18 UTC] [KAT] [message] - --------- Kunpeng Auto Tuner - Step <params prepare> start ----------------- [2024-12-31 08:17:24 UTC] [KAT] [message] - ================================================================================ [2024-12-31 08:17:24 UTC] [KAT] [message] - Kunpeng Auto Tuner - base line test [2024-12-31 08:17:24 UTC] [KAT] [message] - start time: 2024-12-31 08:17:24 [2024-12-31 08:17:24 UTC] [KAT] [message] - -------------------------------------------------------------------------------- [2024-12-31 08:17:24 UTC] [KAT] [message] - --------- Kunpeng Auto Tuner - Step <round set up> start ----------------- [2024-12-31 08:17:24 UTC] [KAT] [message] - --------- Kunpeng Auto Tuner - Step <run test> start ----------------- [2024-12-31 08:18:21 UTC] [KAT] [message] - ### Run test successfully. Performance of this round is [141.87] ### [2024-12-31 08:18:21 UTC] [KAT] [message] - --------- Kunpeng Auto Tuner - Step <round tear down> start ----------------- [2024-12-31 08:18:25 UTC] [KAT] [message] - ================================================================================ [2024-12-31 08:18:25 UTC] [KAT] [message] - Kunpeng Auto Tuner - round 1 [2024-12-31 08:18:25 UTC] [KAT] [message] - start time: 2024-12-31 08:18:25 [2024-12-31 08:18:25 UTC] [KAT] [message] - -------------------------------------------------------------------------------- [2024-12-31 08:18:25 UTC] [KAT] [message] - --------- Kunpeng Auto Tuner - Step <round set up> start ----------------- [2024-12-31 08:18:25 UTC] [KAT] [message] - --------- Kunpeng Auto Tuner - Step <assign params> start ----------------- [2024-12-31 08:18:57 UTC] [KAT] [message] - --------- Kunpeng Auto Tuner - Step <run test> start ----------------- [2024-12-31 08:19:17 UTC] [KAT] [message] - ### Run test successfully. Performance of this round is [159.93] ### [2024-12-31 08:19:17 UTC] [KAT] [message] - --------- Kunpeng Auto Tuner - Step <round tear down> start ----------------- ... ... ... [2024-12-31 08:24:20 UTC] [KAT] [message] - ============================== Auto Tuning Report ============================== [2024-12-31 08:24:20 UTC] [KAT] [message] - Total round : 5 [2024-12-31 08:24:20 UTC] [KAT] [message] - Total run : 6 [2024-12-31 08:24:20 UTC] [KAT] [message] - Fail times : 0 [2024-12-31 08:24:20 UTC] [KAT] [message] - Application : Postgresql [2024-12-31 08:24:20 UTC] [KAT] [message] - Tuning Direction : high [2024-12-31 08:24:20 UTC] [KAT] [message] - Performance description: tpmC, transactions per minute [2024-12-31 08:24:20 UTC] [KAT] [message] - Baseline performance : 141.87 [2024-12-31 08:24:20 UTC] [KAT] [message] - Top 10 performance: [2024-12-31 08:24:20 UTC] [KAT] [message] - -------------------------------------------------------------------------------- [2024-12-31 08:24:20 UTC] [KAT] [message] - | Rank | Round | Performance | Improvement (%) | [2024-12-31 08:24:20 UTC] [KAT] [message] - -------------------------------------------------------------------------------- [2024-12-31 08:24:20 UTC] [KAT] [message] - | 1 | round 5 | 174.94 | 23.31 | [2024-12-31 08:24:20 UTC] [KAT] [message] - | 2 | round 1 | 159.93 | 12.73 | [2024-12-31 08:24:20 UTC] [KAT] [message] - | 3 | round 3 | 155.5 | 9.61 | [2024-12-31 08:24:20 UTC] [KAT] [message] - | 4 | round 4 | 141.94 | 0.05 | [2024-12-31 08:24:20 UTC] [KAT] [message] - | 5 | round 2 | 114.16 | -19.53 | [2024-12-31 08:24:20 UTC] [KAT] [message] - -------------------------------------------------------------------------------- [2024-12-31 08:24:20 UTC] [KAT] [message] - Note: [2024-12-31 08:24:20 UTC] [KAT] [message] - The performance value is the return value of the run test step, [2024-12-31 08:24:20 UTC] [KAT] [message] - Performance improvement (%) = [2024-12-31 08:24:20 UTC] [KAT] [message] - (round performance - baseline performance) / baseline performance * 100 [2024-12-31 08:24:20 UTC] [KAT] [message] - Case package locate: /opt/template/template_xxxx/train-20241231-161557 [2024-12-31 08:24:20 UTC] [KAT] [message] - ================================================================================
- Check the tuning result.
The parameter sets after automatic tuning are generated in the /opt/template/template_xxxx/train-20241231-161557 directory. You can select a parameter set based on the tuning result to adjust application parameters.
1ls /opt/template/template_xxxx/train-20241231-161557Command output:
1param_cfg.json task_cfg.json train.db
- Use the tuning result.
1devkit kat use -i /opt/template/template_xxxx/train-20241231-161557
Go to the interactive user interface.
- View the performance test data.
Type show 1 and press Enter to view the parameters and performance data of the first round of automatic tuning.
Figure 3 Details about the first round
Type top 3 and press Enter to view the three rounds with the best performance data.
Figure 4 Performance data
- (Optional) Perform a test again.
Type test r1 and press Enter to retest the first round of task.
Figure 5 Retest
- (Optional) Apply the parameters of a specified round to the application and system.
Type set 1 and press Enter to apply the parameters of the first round of automatic tuning to the application and system.
Figure 6 Value assignment
- (Optional) Reset the application and system parameters to the original values before value assignment.
Type reset and press Enter to reset the parameters of the first round to the initial values.
Command output:
1[2024-12-31 03:53:23 UTC] [KAT] [message] - --------- Kunpeng Auto Tuner - Step <params recover> start -----------------
- Exit the interactive user interface.
Type exit and press Enter.
Command output:
1 2 3 4 5 6 7 8
[2024-12-31 13:50:40 UTC] [KAT] [message] - Finish using /opt/template/template_xxxx/train-20241231-161557, goodbye! [2024-12-31 13:50:40 UTC] [KAT] [message] - ================================================================================ [2024-12-31 13:50:40 UTC] [KAT] [message] - Kunpeng Auto Tuner - task tear down [2024-12-31 13:50:40 UTC] [KAT] [message] - start time: 2024-12-31 16:25:40 [2024-12-31 13:50:40 UTC] [KAT] [message] - -------------------------------------------------------------------------------- [2024-12-31 13:50:40 UTC] [KAT] [message] - --------- Kunpeng Auto Tuner - Step <params recover> start ----------------- [2024-12-31 13:50:41 UTC] [KAT] [message] - --------- Kunpeng Auto Tuner - Step <tear down> start ----------------- [2024-12-31 13:50:43 UTC] [KAT] [message] - ================================================================================