Rate This Document
Findability
Accuracy
Completeness
Readability

Enabling Automatic Tuning

Command Function

Enables automatic tuning. The Kunpeng AutoTuner automatically tunes task parameters based on service scenario metrics.

Syntax

1
devkit kat train [-h] [-l {0,1,2,3}] -t <file> [-p <file>] [-o <dir>]

Parameter Description

Table 1 Parameter description

Parameter

Option

Description

-h/--help

-

Obtains help information.

-l/--log-level

0/1/2/3

Log level, which defaults to 2.
  • 0: DEBUG
  • 1: INFO
  • 2: WARNING
  • 3: ERROR

-t/--task-cfg

-

Path to the task configuration file.

-p/--param-cfg

-

Path to the configuration file of application parameters.

-o/--output

-

Name of the task result file. If this parameter is not specified, a file in the kat-YMD-HMS format is generated in the current directory.

Example

1
devkit 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 /opt/template/template_xxxx/task_Postgresql.json file and the application parameters have been configured in the /opt/template/template_xxxx/param_Postgresql.json file. The results are displayed in descending order of performance data.

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 /home/kat_show/DevKit-CLI-24.0.T50-Linux-Kunpeng/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: /home/kat_show/DevKit-CLI-24.0.T50-Linux-Kunpeng/train-20241231-161557
[2024-12-31 08:24:20 UTC] [KAT] [message] - ================================================================================

The parameter sets after automatic tuning are generated in the /opt/template/template_xxxx/train-20241231-xxxxxx directory. You can select a parameter set based on the tuning result to adjust application parameters.

1
ls /opt/template/template_xxxx/train-20241231-xxxxxx

Command output:

1
param_cfg.json  task_cfg.json  train.db

This directory contains the data file train.db generated after automatic tuning, the application parameter configuration file param_cfg.json, and the task parameter configuration file task_cfg.json.