Skip to main content

系统智能性能调优工具A-Tune

系统智能性能调优工具A-Tune

概述

Tune是一款基于AI开发的系统性能优化引擎。它利用人工智能技术,对业务场景建立精准的系统画像,感知并推理出业务特征,进而做出智能决策,匹配并推荐最佳的系统参数配置组合,使业务处于最佳运行状态。

支持业务模型

表4.1A-tune支持的业务模型

业务大类 业务类型 瓶颈点 支持的应用

default
默认类型 算力、内存、网络、IO各维度资源使用率都不高 N/A

webserver
web应用 算力瓶颈、网络瓶颈 Nginx、Apache Traffic Server

database
数据库 算力瓶颈、内存瓶颈、IO瓶颈 Mongodb、Mysql、Postgresql、Mariadb

big-data
大数据 算力瓶颈、内存瓶颈 Hadoop-hdfs、Hadoop-spark

middleware
中间件框架 算力瓶颈、网络瓶颈 Dubbo

in-memory-database
内存数据库 内存瓶颈、IO瓶颈 Redis

basic-test-suite
基础测试套 算力瓶颈、内存瓶颈 SPECCPU2006、SPECjbb2015

hpc
人类基因组 算力瓶颈、内存瓶颈、IO瓶颈 Gatk4

storage
存储 网络瓶颈、IO瓶颈 Ceph

virtualization
虚拟化 算力瓶颈、内存瓶颈、IO瓶颈 Consumer-cloud、Mariadb

docker
容器 算力瓶颈、内存瓶颈、IO瓶颈 Mariadb

使用限制

  • A-Tune不能和tuned工具一起使用,两者存在部分调优场景配置冲突。

  • 只有root用户可以修改A-Tune场景静态识别功能配置文件“/etc/atune/tune_rule.conf”。

安装A-Tune

安装模式介绍

A-Tune支持单机模式和分布式模式安装:

  • 单机模式:client和server安装到同一台机器上。

  • 分布式模式:client和server分别安装在不同的机器上。

安装操作

230执行如下命令,安装A-Tune服务端。

yum install atune atune-engine -y

:::note 本步骤会同时安装服务端和客户端软件包。 :::

231若为分布式部署,请执行如下命令,安装A-Tune客户端。若为单机部署,请跳过该步骤。

yum install atune-client -y

232执行如下命令,验证是否安装成功。若回显信息如下所示,表示安装成功。

rpm -qa | grep atune

atune-client-xxx

atune-db-xxx

atune-xxx

atune-engine-xxx

配置A-Tune

配置介绍

A-Tune配置文件“/etc/atuned/atuned.cnf”的配置项说明如下所示:

  • A-Tune服务启动配置,可根据需要进行修改。

◆protocol:系统grpc服务使用的协议,unix或tcp。unix为本地socket通信方式,tcp为socket监听端口方式。默认为unix。

◆address:系统grpc服务的侦听地址,默认为unix socket。若为分布式部署,需修改为侦听的IP地址。

◆port:系统grpc服务的侦听端口,范围为0~65535未使用的端口。如果protocol配置是unix,则不需要配置。

◆connect:若为集群部署时,atune所在节点的IP列表,IP地址以逗号隔开。

◆rest_host:系统rest service的侦听地址,默认为localhost。

◆rest_port:系统rest service的侦听端口,范围为0~65535未使用的端口,默认为8383。

◆engine_host:与系统atune engine service链接的地址。

◆engine_port:与系统atune engine service链接的端口。

◆sample_num:系统执行analysis流程时采集样本的数量,默认为20。

◆interval:系统执行analysis流程时采集样本的间隔时间,默认为5s。

◆grpc_tls:系统grpc的SSL/TLS证书校验开关,默认不开启。开启grpc_tls后,atune-adm命令在使用前需要设置以下环境变量方可与服务端进行通讯:

◆tlsservercafile:gPRC服务端CA证书路径。

◆tlsservercertfile:gPRC服务端证书路径。

◆tlsserverkeyfile:gPRC服务端秘钥路径。

◆rest_tls:系统rest service的SSL/TLS证书校验开关,默认开启。

◆tlsrestcacertfile:系统rest service的服务端CA证书路径。

◆tlsrestservercertfile:系统rest service的服务端证书路径

◆tlsrestserverkeyfile:系统rest service的服务端秘钥路径。

◆engine_tls:系统atune engine service的SSL/TLS证书校验开关,默认开启。

◆tlsenginecacertfile:系统atune engine service的客户端CA证书路径。

◆tlsengineclientcertfile:系统atune engine service的客户端证书路径。

◆tlsengineclientkeyfile:系统atune engine service的客户端秘钥路径。

  • system信息:system为系统执行相关的优化需要用到的参数信息,必须根据系统实际情况进行修改。

◆disk:执行analysis流程时需要采集的对应磁盘的信息或执行磁盘相关优化时需要指定的磁盘。

◆network:执行analysis时需要采集的对应的网卡的信息或执行网卡相关优化时需要指定的网卡。

◆user:执行ulimit相关优化时用到的用户名。目前只支持root用户。

  • 日志信息:根据情况修改日志的级别,默认为info级别,日志信息打印在“/var/log/messages”中。

  • monitor信息:为系统启动时默认采集的系统硬件信息。

  • tuning信息:tuning为系统进行离线调优时需要用到的参数信息。

◆noise:高斯噪声的评估值。

◆sel_feature:控制离线调优参数重要性排名输出的开关,默认关闭。

配置示例1

############## server ##############

atuned config

[server]

the protocol grpc server running on

ranges: unix or tcp

protocol = unix

​

the address that the grpc server to bind to

default is unix socket /var/run/atuned/atuned.sock

ranges: /var/run/atuned/atuned.sock or ip address

address = /var/run/atuned/atuned.sock

​

the atune nodes in cluster mode, separated by commas

it is valid when protocol is tcp

connect = ip01,ip02,ip03

​

the atuned grpc listening port

the port can be set between 0 to 65535 which not be used

port = 60001

​

the rest service listening port, default is 8383

the port can be set between 0 to 65535 which not be used

rest_host = localhost

rest_port = 8383

​

the tuning optimizer host and port, start by engine.service

if engine_host is same as rest_host, two ports cannot be same

the port can be set between 0 to 65535 which not be used

engine_host = localhost

engine_port = 3838

​

when run analysis command, the numbers of collected data.

default is 20

sample_num = 20

​

interval for collecting data, default is 5s

interval = 5

​

enable gRPC authentication SSL/TLS

default is false

grpc_tls = false

tlsservercafile = /etc/atuned/grpc_certs/ca.crt

tlsservercertfile = /etc/atuned/grpc_certs/server.crt

tlsserverkeyfile = /etc/atuned/grpc_certs/server.key

​

enable rest server authentication SSL/TLS

default is true

rest_tls = true

tlsrestcacertfile = /etc/atuned/rest_certs/ca.crt

tlsrestservercertfile = /etc/atuned/rest_certs/server.crt

tlsrestserverkeyfile = /etc/atuned/rest_certs/server.key

​

enable engine server authentication SSL/TLS

default is true

engine_tls = true

tlsenginecacertfile = /etc/atuned/engine_certs/ca.crt

tlsengineclientcertfile = /etc/atuned/engine_certs/client.crt

tlsengineclientkeyfile = /etc/atuned/engine_certs/client.key

​

​

############## log ##############

[log]

either "debug", "info", "warn", "error", "critical", default is "info"

level = info

​

############## monitor ##############

[monitor]

with the module and format of the MPI, the format is {module}_{purpose}

the module is Either "mem", "net", "cpu", "storage"

the purpose is "topo"

module = mem_topo, cpu_topo

​

############## system ##############

you can add arbitrary key-value here, just like key = value

you can use the key in the profile

[system]

the disk to be analysis

disk = sda

​

the network to be analysis

network = enp189s0f0

​

user = root

############## tuning ##############

tuning configs

[tuning]

noise = 0.000000001

sel_feature = false

可根据需要修改A-Tune engine配置文件“/etc/atuned/engine.cnf”,可用配置项说明如下所示:

  • engine_host:系统atune engine service的侦听地址,默认为localhost。

  • engine_port:系统atune engine service的侦听端口,范围为0~65535未使用的端口,默认为3838。

  • engine_tls:系统atune engine service的SSL/TLS证书校验开关,默认开启。

  • tlsenginecacertfile:系统atune engine service的服务端CA证书路径。

  • tlsengineservercertfile:系统atune engine service的服务端证书路径

  • tlsengineserverkeyfile:系统atune engine service的服务端秘钥路径。

  • 日志信息:根据情况修改日志的级别,默认为info级别,日志信息打印在/var/log/messages中。

配置示例2

############## engine ##############

[server]

the tuning optimizer host and port, start by engine.service

if engine_host is same as rest_host, two ports cannot be same

the port can be set between 0 to 65535 which not be used

engine_host = localhost

engine_port = 3838

​

enable engine server authentication SSL/TLS

default is true

engine_tls = true

tlsenginecacertfile = /etc/atuned/engine_certs/ca.crt

tlsengineservercertfile = /etc/atuned/engine_certs/server.crt

tlsengineserverkeyfile = /etc/atuned/engine_certs/server.key

​

############## log ##############

[log]

either "debug", "info", "warn", "error", "critical", default is "info"

level = info

A-Tune静态场景识别规则配置:配置文件以"[ ]"为章节,从上到下一次执行匹配该章节配置的正则式。正则式返回非空,则输出对应的场景名称;如果匹配到多个场景,则以第一个场景为准;如果没有配置到任何规则,则输出默认场景“default-default”。

配置示例3

[oracle]

process=.oracle.

[mssql]

process=.sqlservr.

​

[atomic-host]

virt=

system=.atomic.

​

[atomic-guest]

virt=.+

system=.atomic.

​

[throughput-performance]

virt=

system=.(computenode|server).

[virtual-guest]

virt=.+

[balanced]

启动A-Tune

A-Tune安装完成后,需要启动A-Tune服务才能使用。

233执行如下命令,启动atuned服务。

systemctl start atuned

234执行如下命令,查询atuned服务状态。

systemctl status atuned

235若回显信息如下图所示,表示服务启动成功。

Active:active (running) since Sat 2019-12-21 19:28:47CST;7sago Main PID:94790(atuned) Tasks:19 (Limit:104856) Memory: 132.2M CGroup: /system.slice/atuned.service -94790/usr/bin/atuned -94797 python3 /usr/libexec/atuned/analysis/app-py /etc/atuned/atuned.cnf -94801 /usr/bin/python3 -c from multiprocessing.semaphore_tracker import main;main(3))

启动A-Tune engine

若需要使用AI相关的功能,需要启动A-Tune engine服务才能使用。

236执行如下命令,启动atune-engine服务。

systemctl start atune-engine

237执行如下命令,查询atune-engine服务状态。

systemctl status atune-engine

238若回显信息如下图所示,表示服务启动成功。

Active:active(running)since Sat 2020-09-05 04:24:12 EDT;33min ago Main PID:476292(python3) Tasks:3 Memory: 102.5M CGroup:/system.slice/atune-engine.service 476292/usr/bin/python3 /usr/Libexec/atuned/analysis/app_engine.py /etc/atuned/atuned.cnf 476312/usr/bin/python3-c from multiprocessing.semaphore tracker import main; main(3))

使用方法

用户可以通过命令行客户端atune-adm使用A-Tune提供的功能。本章介绍A-Tune客户端包含的功能和使用方法。

总体说明

  • 使用A-Tune需要使用root权限。

  • atune-adm支持的命令可通过执行atune-adm help/–help/-h命令查询。

  • 使用方法中所有命令的使用举例都是在单机部署模式下,如果是在分布式部署模式下,需要指定服务器IP地址和端口号,例如:

atune-adm -a 192.168.3.196 -p 60001 list

  • define、update、undefine、collection、train、upgrade不支持远程执行。

  • 命令格式中,[ ]表示参数可选,<>表示参数必选,具体参数由实际情况确定。

查询负载类型

  • 命令字:list

  • 功能描述:查询系统当前支持的profile,以及当前处于active状态的profile。

  • 命令格式:atune-adm list

  • 使用示例:

atune-adm list

​

Support profiles:

+------------------------------------------------+-----------+--------------------+

| ProfileName                                   | Active   | ProfileAttr       |

+================================================+===========+====================+

| arm-native-android-container-robox             | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| atomic-guest-tuned                             | false     | static_analysis   |

+------------------------------------------------+-----------+--------------------+

| atomic-host-tuned                             | false     | static_analysis   |

+------------------------------------------------+-----------+--------------------+

| balanced-tuned                                 | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| basic-test-suite-baseline-fio                 | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| basic-test-suite-baseline-lmbench             | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| basic-test-suite-baseline-netperf             | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| basic-test-suite-baseline-stream               | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| basic-test-suite-baseline-unixbench           | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| basic-test-suite-baseline-fio                 | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| basic-test-suite-baseline-lmbench             | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| basic-test-suite-baseline-netperf             | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| basic-test-suite-baseline-stream               | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| basic-test-suite-baseline-unixbench           | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| basic-test-suite-speccpu-speccpu2006           | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| basic-test-suite-specjbb-specjbb2015           | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-hdfs-dfsio-hdd                 | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-hdfs-dfsio-ssd                 | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-bayesian                 | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-kmeans                   | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-sql1                     | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-sql10                   | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-sql2                     | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-sql3                     | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-sql4                     | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-sql5                     | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-sql6                     | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-sql7                     | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-sql8                     | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-sql9                     | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-tersort                 | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| big-data-hadoop-spark-wordcount               | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| cloud-compute-kvm-host                         | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| database-mariadb-2p-tpcc-c3                   | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| database-mariadb-4p-tpcc-c3                   | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| database-mongodb-2p-sysbench                   | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| database-mysql-2p-sysbench-hdd                 | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| database-mysql-2p-sysbench-ssd                 | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| database-postgresql-2p-sysbench-hdd           | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| database-postgresql-2p-sysbench-ssd           | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| default-default                               | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| docker-mariadb-2p-tpcc-c3                     | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| docker-mariadb-4p-tpcc-c3                     | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| fileserver-vsftpd-download                     | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| hpc-gatk4-human-genome                         | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| in-memory-database-redis-redis-benchmark       | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| latency-performance-tuned                     | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| middleware-dubbo-dubbo-benchmark               | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| mssql-tuned                                   | false     | static_analysis   |

+------------------------------------------------+-----------+--------------------+

| network-latency-tuned                         | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| network-throughput-tuned                       | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| oracle-tuned                                   | false     | static_analysis   |

+------------------------------------------------+-----------+--------------------+

| sap-hana-tuned                                 | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| sap-hana-vmware-tuned                         | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| sap-netweaver-tuned                           | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| storage-ceph-vdbench-hdd                       | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| storage-ceph-vdbench-ssd                       | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| test_service-test_app-test_scenario           | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| throughput-performance-tuned                   | false     | static_analysis   |

+------------------------------------------------+-----------+--------------------+

| virtual-guest-tuned                           | true     | static_analysis   |

+------------------------------------------------+-----------+--------------------+

| virtual-host-tuned                             | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| virtualization-consumer-cloud-olc             | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| virtualization-mariadb-2p-tpcc-c3             | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| virtualization-mariadb-4p-tpcc-c3             | false     | manual_active     |

+------------------------------------------------+-----------+--------------------+

| web-apache-traffic-server-spirent-pingpo       | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| web-nginx-http-long-connection                 | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

| web-nginx-https-short-connection               | false     | model_analysis     |

+------------------------------------------------+-----------+--------------------+

:::note Active为true表示当前激活的profile,例如,上述示例中的当前激活的profile是virtual-guest-tuned。ProfileAttr为manual_active,表示需手动激活;为model_analysis,表示可AI识别;为static_analysis,表示可用analysis-static自动识别。 :::

动态分析负载类型并自优化

  • 命令字:analysis

  • 功能描述:采集系统的实时统计数据进行负载类型识别,并进行自动优化。

  • 命令格式:atune-adm analysis [选项]

  • 参数说明:

表4.1analysis参数说明

参数 描述

--model/-m
用户自训练产生的新模型。

--characterization/-c
使用默认的模型进行应用识别,不进行自动优化。
  • 使用示例

◆执行如下命令,使用默认的模型进行应用识别。

atune-adm analysis --characterization

◆执行如下命令,使用默认的模型进行应用识别,并进行自动优化。

atune-adm analysis

◆执行如下命令,使用自训练的模型进行应用识别。

atune-adm analysis --model /usr/libexec/atuned/analysis/models/new-model.m

静态识别场景并自优化

  • 命令字:analysis-static

  • 功能描述:静态分析系统类型,并进行自动优化。

  • 命令格式:atune-adm analysis-static [选项]

  • 参数说明

表4.2analysis-static参数说明

参数 描述

--characterization/-c
只静态分析系统负载,不进行调优。
  • 使用示例

◆执行如下命令,使用静态场景识别来识别系统当前场景。

atune-adm analysis-static --characterization

◆执行如下命令,使用静态场景识别来识别系统当前场景,并进行自动优化。

atune-adm analysis-static

自定义模型

A-Tune支持用户定义并学习新模型,定义新模型的操作流程如下:

239用define命令定义一个新应用的profile。

240用collection命令收集应用对应的系统数据。

241用train命令训练得到模型。

命令字:define

  • 功能描述:添加用户自定义的应用场景,及对应的profile优化项。

  • 命令格式:atune-adm define

  • 使用示例

242执行如下命令,新增一个profile。其中,service_type的名称为test_service,application_name的名称为test_app,scenario_name的名称为test_scenario,优化项的配置文件为example.conf。

atune-adm define test_service test_app test_scenario ./example.conf

243参考如下内容编写(以下各优化项非必填,仅供参考)“example.conf”,也可执行atune-adm info命令后参考已有的profile是如何书写的。

[main]

list its parent profile

[kernel_config]

to change the kernel config

[bios]

to change the bios config

[bootloader.grub2]

to change the grub2 config

[sysfs]

to change the /sys/* config

[systemctl]

to change the system service status

[sysctl]

to change the /proc/sys/* config

[script]

the script extention of cpi

[ulimit]

to change the resources limit of user

[schedule_policy]

to change the schedule policy

[check]

check the environment

[tip]

the recommended optimization, which should be performed manunaly

命令字:collection

  • 功能描述:采集业务运行时系统的全局资源使用情况以及操作系统的各项状态信息,并将收集的结果保存到csv格式的输出文件中,作为模型训练的输入数据集。

:::note

■本命令依赖采样工具perf、mpstat、vmstat、iostat、sar。

■CPU型号目前仅支持鲲鹏920,可执行dmidecode -t processor命令检查CPU型号。

■命令格式:atune-adm collection

■参数说明 :::

表4.3collection参数说明

参数 描述

–filename/-f
生成的用于训练的csv文件名,格式为:名称-时间戳.csv。

–output_path/-o
生成的csv文件的存放路径,需提供绝对路径。

–disk/-b
业务运行时实际使用的磁盘,如/dev/sda。

–network/-n
业务运行时使用的网络接口,如eth0。

–app_type/-t
标记业务的应用类型,作为训练时使用的标签。

–duration/-d
业务运行时采集数据的时间,单位秒,默认值为1200秒。

–interval/-i
采集数据的时间间隔,单位秒,默认值为5秒。
  • 使用示例

atune-adm collection --filename name --interval 5 --duration 1200 --output_path /home/data --disk sda --network eth0 --app_type test_type

  • 命令字:train

  • 功能描述:使用采集的数据进行模型的训练。训练时至少采集两种应用类型的数据,否则训练会出错。

  • 命令格式:atune-adm train

  • 参数说明

表4.4train参数说明

参数 描述

–data_path/-d
存放模型训练所需的csv文件的目录。

–output_file/-o
训练生成的新模型。
  • 使用示例:执行如下命令,使用data目录下的csv文件作为训练输入,将生成的新模型new-model.m存放在model目录下。

atune-adm train --data_path /home/data --output_file /usr/libexec/atuned/analysis/models/new-model.m

  • 命令字:undefine

  • 功能描述:删除用户自定义的profile。

  • 命令格式:atune-adm undefine

  • 使用示例:执行如下命令,删除自定义的profile。

atune-adm undefine test_service-test_app-test_scenario

查询profile

  • 命令字:info

  • 功能描述:查看对应的profile内容。

  • 命令格式:atune-adm info

  • 使用示例:执行如下命令,查看web-nginx-http-long-connection的profile内容。

atune-adm info web-nginx-http-long-connection

​

*** web-nginx-http-long-connection:

​

nginx http long connection A-Tune configuration

[main]

include = default-default

​

[kernel_config]

#TODO CONFIG

​

[bios]

#TODO CONFIG

​

[bootloader.grub2]

iommu.passthrough = 1

​

[sysfs]

#TODO CONFIG

​

[systemctl]

sysmonitor = stop

irqbalance = stop

​

[sysctl]

fs.file-max = 6553600

fs.suid_dumpable = 1

fs.aio-max-nr = 1048576

kernel.shmmax = 68719476736

kernel.shmall = 4294967296

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.tcp_tw_reuse = 1

net.ipv4.tcp_syncookies = 1

net.ipv4.ip_local_port_range = 1024     65500

net.ipv4.tcp_max_tw_buckets = 5000

net.core.somaxconn = 65535

net.core.netdev_max_backlog = 262144

net.ipv4.tcp_max_orphans = 262144

net.ipv4.tcp_max_syn_backlog = 262144

net.ipv4.tcp_timestamps = 0

net.ipv4.tcp_synack_retries = 1

net.ipv4.tcp_syn_retries = 1

net.ipv4.tcp_fin_timeout = 1

net.ipv4.tcp_keepalive_time = 60

net.ipv4.tcp_mem = 362619     483495   725238

net.ipv4.tcp_rmem = 4096         87380   6291456

net.ipv4.tcp_wmem = 4096         16384   4194304

net.core.wmem_default = 8388608

net.core.rmem_default = 8388608

net.core.rmem_max = 16777216

net.core.wmem_max = 16777216

​

[script]

prefetch = off

ethtool = -X {network} hfunc toeplitz

​

[ulimit]

{user}.hard.nofile = 102400

{user}.soft.nofile = 102400

​

[schedule_policy]

#TODO CONFIG

​

[check]

#TODO CONFIG

​

[tip]

SELinux provides extra control and security features to linux kernel. Disabling SELinux will improve the performance but may cause security risks. = kernel

disable the nginx log = application

更新profile

用户可根据需要更新已有profile。

  • 命令字:update

  • 功能描述:将已有profile中原来的优化项更新为new.conf中的内容。

  • 命令格式:atune-adm update

  • 使用示例:执行如下命令,更新名为test_service-test_app-test_scenario的profile优化项为new.conf。

atune-adm update test_service-test_app-test_scenario ./new.conf

激活profile

  • 命令字:profile

  • 功能描述:手动激活profile,使其处于active状态。

  • 命令格式:atune-adm profile

  • 参数说明:profile名参考list命令查询结果。

  • 使用示例:执行如下命令,激活web-nginx-http-long-connection对应的profile配置。

atune-adm profile web-nginx-http-long-connection

回滚profile

  • 命令字:rollback

  • 功能描述:回退当前的配置到系统的初始配置。

  • 命令格式:atune-adm rollback

  • 使用示例

atune-adm rollback

更新数据库

  • 命令字:upgrade

  • 功能描述:更新系统的数据库。

  • 命令格式:atune-adm upgrade

  • 参数说明:DB_FILE表示新的数据库文件路径。

  • 使用示例:执行如下命令,数据库更新为new_sqlite.db。

atune-adm upgrade ./new_sqlite.db

系统信息查询

  • 命令字:check

  • 功能描述:检查系统当前的cpu、bios、os、网卡等信息。

  • 命令格式:atune-adm check

  • 使用示例:

atune-adm check

cpu information:

cpu:0 version: pc-i440fx-4.0 speed: 2000000000 HZ cores: 1

cpu:1 version: pc-i440fx-4.0 speed: 2000000000 HZ cores: 1

system information:

DMIBIOSVersion: rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org

OSRelease: 4.19.90-2106.3.0.0095.up2.uel20.x86_64

network information:

name: eth0 product: Virtio network device

name: eth1 product: RTL-8100/8101L/8139 PCI Fast Ethernet Adapter

name: docker0 product:

参数自调优

A-Tune提供了最佳配置的自动搜索能力,免去人工反复做参数调整、性能评价的调优过程,极大地提升最优配置的搜寻效率。

  • 命令字:tuning

  • 功能描述:使用指定的项目文件对参数进行动态空间的搜索,找到当前环境配置下的最优解。

  • 命令格式:atune-adm tuning [选项]

:::note 在运行命令前,需要满足如下条件。

■服务端的yaml配置文件已经编辑完成并放置于atuned服务下的“/etc/atuned/tuning/”目录中。

■客户端的yaml配置文件已经编辑完成并放置于atuned客户端任意目录下。

■参数说明 :::

表4.5tuning参数描述

参数 描述

--restore/-r
恢复tuning优化前的初始配置。

--project/-p
指定需要恢复的yaml文件中的项目名称。

--restart/-c
基于历史调优结果进行调优。

--detail/-d
打印tuning过程的详细信息。

:::note 当使用参数时,-p参数后需要跟具体的项目名称且必须指定该项目yaml文件。PROJECT_YAML表示客户端yaml配置文件。

■配置说明 :::

表4.6服务端yaml文件

配置名称 配置说明 参数类型 取值范围

project
项目名称。 字符串 -

startworkload
待调优服务的启动脚本。 字符串 -

stopworkload
待调优服务的停止脚本。 字符串 -

maxiterations
最大调优迭代次数,用于限制客户端的迭代次数。一般来说,调优迭代次数越多,优化效果越好,但所需时间越长。用户必须根据实际的业务场景进行配置。 整型 >10

object
需要调节的参数项及信息。object配置项请参见下表。 - -

表4.7object项配置说明

配置名称 配置说明 参数类型 取值范围

name
待调参数名称。 字符串 -

desc
待调参数描述。 字符串 -

get
查询参数值的脚本。 - -

set
设置参数值的脚本。 - -

needrestart
参数生效是否需要重启业务。 枚举 "true","false"

type
参数的类型,目前支持discrete、continuous两种类型,对应离散型、连续型参数。 枚举 "discrete","continuous"

dtype
该参数仅在type为discrete类型时配置,目前支持int、float、string类型。 枚举 int,float,string

scope
参数设置范围,仅在type为discrete且dtype为int、float,或type为continuous时生效。 整型/浮点型 用户自定义,取值在该参数的合法范围

step
参数值步长,dtype为int或float时使用。 整型/浮点型 用户自定义

items
参数值在scope定义范围之外的枚举值,dtype为int或float时使用。 整型/浮点型 用户自定义,取值在该参数的合法范围

options
参数值的枚举范围,dtype为string时使用。 字符串 用户自定义,取值在该参数的合法范围

表4.8客户端yaml文件配置说明

配置名称 配置说明 参数类型 取值范围

project
项目名称,需要与服务端对应配置文件中的project匹配。 字符串 -

engine
调优算法。 字符串 "random","forest","gbrt","bayes","extraTrees"

iterations
调优迭代次数。 整型 >=10

random_starts
随机迭代次数。 整型 <iterations

feature_filter_engine
参数搜索算法,用于重要参数选择,该参数可选。 字符串 "lhs"

feature_filter_cycle
参数搜索轮数,用于重要参数选择,该参数配合feature_filter_engine使用。 整型 -

feature_filter_iters
每轮参数搜索的迭代次数,用于重要参数选择,该参数配合feature_filter_engine使用。 整型 -

split_count
调优参数取值范围中均匀选取的参数个数,用于重要参数选择,该参数配合feature_filter_engine使用。 整型 -

benchmark
性能测试脚本。 - -

evaluations
性能测试评估指标evaluations配置项请参见下表。 - -

表4.9evaluations项配置说明

配置名称 配置说明 参数类型 取值范围

name
评价指标名称。 字符串 -

get
获取性能评估结果的脚本。 - -

type
评估结果的正负类型,positive代表最小化性能值,negative代表最大化对应性能值。 枚举 "positive","negative"

weight
该指标的权重百分比。 整型 0-100

threshold
该指标的最低性能要求。 整型 用户指定
  • 配置示例

◆服务端yaml文件配置示例:

project: "compress"

maxiterations: 500

startworkload: ""

stopworkload: ""

object :

name : "compressLevel"

info :

desc : "The compresslevel parameter is an integer from 1 to 9 controlling the level of compression"

get : "cat /root/A-Tune/examples/tuning/compress/compress.py | grep 'compressLevel=' | awk -F '=' '{print $2}'"

set : "sed -i 's/compressLevel=\s*[0-9]*/compressLevel=$value/g' /root/A-Tune/examples/tuning/compress/compress.py"

needrestart : "false"

type : "continuous"

scope :

  • 1

  • 9

dtype : "int"

name : "compressMethod"

info :

desc : "The compressMethod parameter is a string controlling the compression method"

get : "cat /root/A-Tune/examples/tuning/compress/compress.py | grep 'compressMethod=' | awk -F '=' '{print $2}' | sed 's/"//g'"

set : "sed -i 's/compressMethod=\s*[0-9,a-z,"]*/compressMethod="$value"/g' /root/A-Tune/examples/tuning/compress/compress.py"

needrestart : "false"

type : "discrete"

options :

  • "bz2"

  • "zlib"

  • "gzip"

dtype : "string"

◆客户端yaml文件配置示例:

project: "compress"

engine : "gbrt"

iterations : 20

random_starts : 10

benchmark : "python3 /root/A-Tune/examples/tuning/compress/compress.py"

evaluations :

name: "time"

info:

get: "echo '$out' | grep 'time' | awk '{print $3}'"

type: "positive"

weight: 20

name: "compress_ratio"

info:

get: "echo '$out' | grep 'compress_ratio' | awk '{print $3}'"

type: "negative"

weight: 80

  • 使用示例

◆执行如下命令,进行tuning调优。

atune-adm tuning --project compress --detail compress_client.yaml

◆执行如下命令,恢复tuning调优前的初始配置。其中,compress为yaml文件中的项目名称。

atune-adm tuning --restore --project compress

常见问题

请参见“A-Tune常见问题”章节。