Tuned调优工具

Tuned

tuned 是一种监控系统并优化特定工作负载下性能的服务。Tuned 的核心是配置集,它们根据不同的用例对系统进行调优。

tuned 附带许多预定义配置集用于用例,例如:

  • 高吞吐量
  • 低延迟
  • 节能功能
    可以修改为每个配置集定义的规则,并自定义如何调优特定的设备。当切换到另一个配置集或取消激活 Tuned 时,上一个配置集对系统设置所做的所有更改都会恢复到其原始状态。

还可以配置 Tuned 以响应设备使用的变化,并调整设置以提高活跃设备的性能并减少不活跃设备的功耗。

Tuned 配置集

Tuned 提供的配置集分为以下类别:

  • 节能配置集
  • 性能提升配置集

性能提升配置集包括侧重于以下方面的配置集:

  • 存储和网络的低延迟
  • 存储和网络的高吞吐量
  • 虚拟机性能
  • 虚拟化主机性能

默认 Tuned 配置集

在安装过程中,系统的最佳配置集会被自动选择。目前,默认配置集会根据以下可自定义规则选择:
在这里插入图片描述

Tuned 配置集的位置

在以下目录中调优存储配置集

/usr/lib/tuned/
[root@ebadda72dbe8 tuned]# cd /usr/lib/tuned/
[root@ebadda72dbe8 tuned]# ll
total 60
drwxr-xr-x 2 root root  4096 Dec 14 07:41 balanced
drwxr-xr-x 2 root root  4096 Dec 14 07:41 desktop
-rw-r--r-- 1 root root 14687 Feb  2  2021 functions
drwxr-xr-x 2 root root  4096 Dec 14 07:41 hpc-compute
drwxr-xr-x 2 root root  4096 Dec 14 07:41 latency-performance
drwxr-xr-x 2 root root  4096 Dec 14 07:41 network-latency
drwxr-xr-x 2 root root  4096 Dec 14 07:41 network-throughput
drwxr-xr-x 2 root root  4096 Dec 14 07:41 powersave
drwxr-xr-x 2 root root  4096 Dec 14 07:41 recommend.d
drwxr-xr-x 2 root root  4096 Dec 14 08:14 throughput-performance
drwxr-xr-x 2 root root  4096 Dec 14 08:13 virtual-guest
drwxr-xr-x 2 root root  4096 Dec 14 08:06 virtual-host

发行版相关的配置文件存储在 目录中。每个配置集都有自己的目录。该配置集由名为 tuned.conf 的主配置文件以及其他可选文件组成

/etc/tuned/

如果需要自定义配置集,请将配置集目录复制到用于自定义配置集的 目录中。如果同一名称有两个配置集,则使用 /etc/tuned/ 中的自定义配置集。
通过以下命令查看系统提供的默认配置集

[root@ebadda72dbe8 tuned]# tuned-adm list    
Available profiles:
- balanced                    - General non-specialized tuned profile
- desktop                     - Optimize for the desktop use-case
- hpc-compute                 - Optimize for HPC compute workloads
- latency-performance         - Optimize for deterministic performance at the cost of increased power consumption
- network-latency             - Optimize for deterministic performance at the cost of increased power consumption, focused on low latency network performance
- network-throughput          - Optimize for streaming network throughput, generally only necessary on older CPUs or 40G+ networks
- powersave                   - Optimize for low power consumption
- throughput-performance      - Broadly applicable tuning that provides excellent performance across a variety of common server workloads
- virtual-guest               - Optimize for running inside a virtual guest
- virtual-host                - Optimize for running KVM guests
balanced

默认节能配置文件.它旨在成为性能和能耗之间的妥协。它尽可能使用自动扩展和自动调整。唯一缺点是增加了延迟。在当前的 Tuned 版本中,它启用了 CPU、磁盘、音频和视频插件并激活 conservative CPU 调控器。如果支持,radeon_powersave 选项使用 dpm-balanced 值,否则将其设置为 auto

它将 energy_performance_preference 属性更改为 normal 能源设置。它还将 scaling_governor 策略属性改为 conservativepowersave CPU 调控器。

powersave

用于最大节能性能的配置文件。它可以限制性能,从而最大程度减少实际的功耗。在当前的 Tuned 版本中,它为 SATA 主机适配器实现 USB autosuspend、WiFi 节能和 Aggressive Link Power Management(ALPM)节能。它还为低唤醒率的系统调度多核功率节省,并激活 ondemand 调控器。它可节省 AC97 音频功率,或者根据您的系统节省 HDA-Intel 功耗,而超时为 10 秒。如果您的系统包含启用了 KMS 的 Radeon 图形卡,配置集将其配置为自动节能。在 ASUS Eee PC 上启用动态 Super Hybrid Engine。

它将 energy_performance_preference 属性更改为 powersavepower 能源设置。它还将 scaling_governor 策略属性改为 ondemandpowersave CPU 调控器。

throughput-performance

针对高吞吐量优化的服务器配置文件。它禁用节能机制并启用 sysctl 设置,以提高磁盘和网络 IO 的吞吐量性能。CPU 调控器被设置为 performance

它将 energy_performance_preferencescaling_governor 属性更改为 performance 配置集。

accelerator-performance

accelerator-performance 配置集包含与 throughput-performance 配置集相同的调优。另外,它会将 CPU 锁定为低 C 状态,从而使延迟少于 100us。这提高了某些加速器(如 GPU)的性能。

latency-performance

针对低延迟而优化的服务器配置文件。它禁用节能机制并启用可提高延迟的 sysctl 设置。CPU 调控器被设置为 performance,CPU 锁定为低 C 状态(通过 PM QoS)。

它将 energy_performance_preferencescaling_governor 属性更改为 performance 配置集

network-latency

低延迟网络调优配置文件。它基于 latency-performance 配置集。它还禁用透明巨页和 NUMA 平衡,并调整其他几个网络相关的 sysctl 参数。

它继承了将 energy_performance_preferencescaling_governor 属性更改为 performance 配置集的 latency-performance 配置集。

hpc-compute

针对高性能计算优化的配置集。它基于 latency-performance 配置集。

network-throughput

用于吞吐量网络调优的配置文件。它基于 throughput-performance 配置集。它还会增加内核网络缓冲区。

它继承 latency-performancethroughput-performance 配置集,并将 energy_performance_preferencescaling_governor 属性更改为 performance 配置集

virtual-guest

基于 throughput-performance 配置集为 Red Hat Enterprise Linux 8 虚拟机和 VMWare 客户机设计配置集,它可减少虚拟内存交换性并增加磁盘预读值。它不禁用磁盘障碍。

它继承 throughput-performance 配置集,并将 energy_performance_preferencescaling_governor 属性更改为 performance 配置集。

一般是为系统默认配置集

[root@ebadda72dbe8 ~]# tuned-adm active
Current active profile: virtual-guest
virtual-host

基于 throughput-performance 配置集为虚拟主机设计的配置集,除了其它任务外,还可减少虚拟内存交换性,增加磁盘预读值,并启用更积极的脏页面回写值。

它继承 throughput-performance 配置集,并将 energy_performance_preferencescaling_governor 属性更改为 performance 配置集。

oracle

基于 throughput-performance 配置文件优化的 Oracle 数据库负载配置集。它还禁用透明大内存页并修改其他与性能相关的内核参数。这个配置集由 tuned-profiles-oracle 软件包提供。

desktop

基于 balanced 配置文件为桌面优化的配置文件。它还支持调度程序自动组,以更好地响应交互式应用程序。

cpu-partitioning

cpu-partitioning 配置集将系统 CPU 划分为隔离和内务的 CPU。为减少隔离 CPU 上的 jitter 和中断,配置集清除了与用户空间进程、可移动内核线程、中断处理程序和内核计时器隔离的 CPU。

内务 CPU 可以运行所有服务、shell 进程和内核线程。

可以在 /etc/tuned/cpu-partitioning-variables.conf 文件中配置 cpu-partitioning 配置集。配置选项为:

  • isolated_cores=*cpu-list*

    列出要隔离的 CPU。隔离 CPU 的列表用逗号分开,用户可以指定范围。您可以使用破折号指定一个范围,如 3-5。此选项是必需的。此列表中缺少的任何 CPU 都会自动被视为内务 CPU。

创建自定义 Tuned 配置集

  • /etc/tuned/ 目录中,创建一个名为与您要创建的配置集相同的新目录:
[root@ebadda72dbe8 tuned]# pwd
/etc/tuned
[root@ebadda72dbe8 tuned]# mkdir test_cpu_partitioning
  • 在新目录中,创建名为 tuned.conf 的文件。根据您的要求,添加 [main] 部分和其中的插件定义。
[root@ebadda72dbe8 tuned]# vim test_cpu_partitioning/tuned.conf 
[main]
summary=General non-specialized tuned profile
include=virtual-guest   ###继承virtual-guest功能属性

[variables]
include =/etc/tuned/cpu-partitioning-variables.conf

配置文件/etc/tuned/cpu-partitioning-variables.conf,添加如下内容,用于隔离cpu
isolated_cores = 3
隔离系统中的第4个cpu
  • 要激活配置集,请使用:
重启tuned
systemctl restart tuned 
查看新创建的配置集
[root@ebadda72dbe8 tuned]# tuned-adm list    
Available profiles:
- balanced                    - General non-specialized tuned profile
- desktop                     - Optimize for the desktop use-case
- hpc-compute                 - Optimize for HPC compute workloads
- latency-performance         - Optimize for deterministic performance at the cost of increased power consumption
- network-latency             - Optimize for deterministic performance at the cost of increased power consumption, focused on low latency network performance
- network-throughput          - Optimize for streaming network throughput, generally only necessary on older CPUs or 40G+ networks
- powersave                   - Optimize for low power consumption
- test_cpu_partitioning       - General non-specialized tuned profile
- throughput-performance      - Broadly applicable tuning that provides excellent performance across a variety of common server workloads
- virtual-guest               - Optimize for running inside a virtual guest
- virtual-host                - Optimize for running KVM guests

激活创建的配置集
[root@ebadda72dbe8 tuned]# tuned-adm profile test_cpu_partitioning
  • 验证 Tuned 配置集是否活跃并应用系统设置:
[root@ebadda72dbe8 tuned]# tuned-adm active
Current active profile: test_cpu_partitioning
  • 1
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值