Rate This Document
Findability
Accuracy
Completeness
Readability

Enabling Automatic Tuning

After this command is run, the Kunpeng AutoTuner tunes parameters in the parameter spaces based on service scenario metrics.

Command Function

Starts 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.
NOTE:

The default level is 2 (WARNING).

  • 0: DEBUG
  • 1: INFO
  • 2: WARNING
  • 3: ERROR

-t/--task-cfg

-

Path to the task configuration file. This parameter is mandatory.

-p/--param-cfg

-

Path to the configuration file of application parameters. This parameter is mandatory.

-o/--output

-

Output directory of the task result file. If you do not set this parameter, a folder in the format of train-YMD-HMS format is generated in the current directory. Do not use an existing directory. This parameter is optional.

Example

The following uses PostgreSQL as an example.

devkit kat train -t /opt/template/template_Postgresql_20250225_091524/task_Postgresql.yaml -p /opt/template/template_Postgresql_20250225_091524/param_Postgresql.yaml -o /opt/template/train

The task parameters have been configured in the /opt/template/template_Postgresql_20250225_091524/task_Postgresql.yaml file and the application parameters have been configured in the /opt/template/template_Postgresql_20250225_091524/param_Postgresql.yaml 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
[2025-02-25 11:28:32 UTC] [KAT] [message] - ============================== Auto Tuning Report ==============================
[2025-02-25 11:28:32 UTC] [KAT] [message] - Total round             : 5
[2025-02-25 11:28:32 UTC] [KAT] [message] - Total run               : 6
[2025-02-25 11:28:32 UTC] [KAT] [message] - Fail times              : 0
[2025-02-25 11:28:32 UTC] [KAT] [message] - Application             : Postgresql
[2025-02-25 11:28:32 UTC] [KAT] [message] - Application version     : 11.3
[2025-02-25 11:28:32 UTC] [KAT] [message] - Test tool               : benchmarksql
[2025-02-25 11:28:32 UTC] [KAT] [message] - Tuning direction        : high
[2025-02-25 11:28:32 UTC] [KAT] [message] - Algorithm               : HPO
[2025-02-25 11:28:32 UTC] [KAT] [message] - Random initial ratio    : 0.5
[2025-02-25 11:28:32 UTC] [KAT] [message] - Performance description : tpmC, transactions per minute
[2025-02-25 11:28:32 UTC] [KAT] [message] - Parameter groups        : Postgresql
[2025-02-25 11:28:32 UTC] [KAT] [message] - Baseline performance    : 81.7
[2025-02-25 11:28:32 UTC] [KAT] [message] - Top 5 performance :
[2025-02-25 11:28:32 UTC] [KAT] [message] - --------------------------------------------------------------------------------
[2025-02-25 11:28:32 UTC] [KAT] [message] - |  Rank  |     Round     |  Performance   |  Improvement  (%) |
[2025-02-25 11:28:32 UTC] [KAT] [message] - --------------------------------------------------------------------------------
[2025-02-25 11:28:32 UTC] [KAT] [message] - |   1    |   round  1    |     121.59     |       48.82       |
[2025-02-25 11:28:32 UTC] [KAT] [message] - |   2    |   round  2    |     98.48      |       20.54       |
[2025-02-25 11:28:32 UTC] [KAT] [message] - |   3    |   round  3    |     96.55      |       18.18       |
[2025-02-25 11:28:32 UTC] [KAT] [message] - |   4    |   round  5    |     84.38      |        3.28       |
[2025-02-25 11:28:32 UTC] [KAT] [message] - |   5    |   round  4    |     82.07      |        0.45       |
[2025-02-25 11:28:32 UTC] [KAT] [message] - --------------------------------------------------------------------------------
[2025-02-25 11:28:32 UTC] [KAT] [message] - Note:
[2025-02-25 11:28:32 UTC] [KAT] [message] - The performance value is the return value of the run test step,
[2025-02-25 11:28:32 UTC] [KAT] [message] - Performance improvement (%) =
[2025-02-25 11:28:32 UTC] [KAT] [message] -     (round performance - baseline performance) / baseline performance * 100
[2025-02-25 11:28:32 UTC] [KAT] [message] - Case package locate: /opt/template/train/train-20250225-112832
[2025-02-25 11:28:32 UTC] [KAT] [message] - ================================================================================

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

In the example, the performance metric is tpmC and the baseline performance is 81.7. After five rounds of automatic tuning, the optimal performance reaches 121.59, presenting an increase of 48.82% over the baseline performance. The directory for saving the tuning result file is provided at the end of the command output, and can be used in subsequent tuning result processing.

In PostgreSQL database performance tests, tpmC is a key performance metric derived from the TPC-C benchmark.