TuneD命令

TuneD是RedHat用于监控系统并优化特定工作负载性能的服务。TuneD的核心是配置集(profiles),它针对不同的用例调优Linux系统。

TuneD可以通过预定义的配置集发布,适用于以下用例:

  • 高吞吐量

  • 低延迟

  • 保存电源

TuneD 提供的配置集被分为以下几个类别:

  • 节能配置集

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

  • 存储和网络的低延迟

  • 存储和网络的高吞吐量

  • 虚拟机性能

  • 虚拟化主机性能

TuneD 配置集的位置

TuneD 配置集存储在以下目录中: /usr/lib/tuned/ 特定于分发的配置文件存储在目录中。每个配置集都有自己的目录。该配置集由名为 tuned.conf 的主配置文件以及其他文件(如帮助程序脚本)组成。

/etc/tuned/ 如果您需要自定义配置集,请将配置集目录复制到用于自定义配置集的目录中。如果同一名称有两个配置集,则使用位于 /etc/tuned/ 中的自定义配置集。


默认配置集及说明

balanced

默认的节能配置文件。它在性能和功耗之间具有折衷。在可能的情况下尽可能使用自动扩展和自动调整。唯一缺陷是增加延迟。在当前的 TuneD 版本中,它启用了 CPU、磁盘、音频和视频插件,并激活了 conservative CPU 调控器。如果支持,radeon_powersave 选项使用 dpm-balanced 值,否则被设置为 auto。 它将 energy_performance_preference 属性改为 normal 能源设置。它还将 scaling_governor 策略属性改为 conservative 或 powersave CPU 调控器。

powersave

用于最大节能性能的配置集。它可以对性能进行调整,从而最大程度降低实际功耗。在当前的 TuneD 发行版本中,它为 SATA 主机适配器启用 USB 自动挂起、WiFi 节能和 Aggresive Link Power Management (ALPM) 节能。它还为使用低折率的系统调度多核功耗,并激活 ondemand 监管器。它启用了 AC97 音频节能,或根据您的系统,HDA-Intel 节能时间为 10 秒。如果您的系统包含启用了 KMS 支持的 Radeon 图形卡,配置集会将其配置为自动节能。在 ASUS Eee PC 上,启用了动态超级混合引擎。

它将 energy_performance_preference 属性改为 powersave 或 power energy 设置。它还会将 scaling_governor 策略属性更改为 ondemand 或 powersave CPU 调控器。

在某些情况下,与 powersave 配置集相比,balanced 配置集效率更高。

请考虑存在定义的需要完成的工作,例如一个需要转码的视频文件。如果转码以全功率完成,则您的机器可能会消耗较少的能源,因为任务快速完成,因此计算机可以启动空闲,且自动缩减到非常有效的节能模式。另一方面,如果您把文件转码为节流的机器,则计算机在转码期间会消耗较少的电源,但进程会花费更长时间,且总体消耗的能源可能会更高。

这就是为什么 balanced 配置文件通常是一个更好的选择。

throughput-performance

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

它将 energy_performance_preference 和 scaling_governor 属性设置为 performance 配置集。

accelerator-performance

accelerator-performance 配置集包含与 throughput-performance 配置集相同的调整。另外,它会将 CPU 锁定为低 C 状态,以便使延迟小于 100us。这提高了某些加速器的性能,如 GPU。 latency-performance 为低延迟优化的服务器配置文件。它禁用节能机制并启用 sysctl 设置来缩短延迟。CPU 调控器被设置为 performance,CPU 被锁定到低 C 状态(按 PM QoS)。

它将 energy_performance_preference 和 scaling_governor 属性设置为 performance 配置集。

network-latency

低延迟网络调整的配置集。它基于 latency-performance 配置集。它还禁用透明大内存页和 NUMA 平衡,并调整其他一些与网络相关的 sysctl 参数。

它继承 latency-performance 配置集,该配置集将 power_performance_preference 和 scaling_governor 属性更改为 performance 配置集。

hpc-compute

针对高性能计算而优化的配置集。它基于 latency-performance 配置集。 network-throughput 用于吞吐量网络调优的配置集。它基于 throughput-performance 配置集。此外,它还增加了内核网络缓冲区。

它继承 latency-performance 或 throughput-performance 配置集,并将 energy_performance_preference 和 scaling_governor 属性改为 performance 配置集。

virtual-guest

为 Red Hat Enterprise Linux 8 虚拟机和 VMWare 虚拟机设计的配置集基于 throughput-performance 配置集(除其他任务)减少了虚拟内存的交换性并增加磁盘预读值。它不会禁用磁盘障碍。

它继承 throughput-performance 配置集,该配置集将 energy_performance_preference 和 scaling_governor 属性更改为 performance 配置集。

virtual-host

基于 throughput-performance 配置集(除其他任务)为虚拟主机设计的配置集降低了虚拟内存交换,增加磁盘预读值,并启用更主动的脏页面回写值。

它继承 throughput-performance 配置集,该配置集将 energy_performance_preference 和 scaling_governor 属性更改为 performance 配置集。

oracle

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

desktop

根据 balanced 配置文件,为桌面进行了优化的配置集。此外,它还启用了调度程序自动组以更好地响应交互式应用程序。

optimize-serial-console

通过减少 printk 值,将 I/O 活动微调到串行控制台的配置集。这应该使串行控制台更快响应。此配置集用作其他配置集的覆盖。例如:

tuned-adm profile throughput-performance optimize-serial-console

mssql

为 Microsoft SQL Server 提供的配置集。它基于 throughput-performance 配置集。

intel-sst

为带有用户定义的 Intel Speed Select Technology 配置的系统进行优化的配置集。此配置集用作其他配置集的覆盖。例如:

tuned-adm profile cpu-partitioning intel-sst

示例:

部分操作示例

# 查看可用的配置集
tuned-adm list
	Available profiles:
	- accelerator-performance     - Throughput performance based tuning with disabled higher latency STOP states
	- balanced                    - General non-specialized tuned profile
	- desktop                     - Optimize for the desktop use-case
	- hpc-compute                 - Optimize for HPC compute workloads
	- intel-sst                   - Configure for Intel Speed Select Base Frequency
	- 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
	- optimize-serial-console     - Optimize for serial console use.
	- 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
	Current active profile: virtual-host


# 查看当前使用的配置集
tuned-adm active
	Current active profile: virtual-host

# 切换配置集
tuned-adm profile virtual-guest

# 同时合并使用几种配置集,以下为切换成虚拟机(virtual-guest)并尽可能的节省能耗(powersave)
tuned-adm profile virtual-guest powersave

修改现有配置集

vi /usr/lib/tuned/balanced/tuned.conf

# 激活该配置
tuned-adm profile balanced 

# 验证是否生效
tuned-adm verify
	Verfication succeeded, current system settings match the preset profile.
	See TuneD log file ('/var/log/tuned/tuned.log') for details.

创建新的配置集

mkdir /etc/tuned/my-profile

# 配置格式可以参考'/usr/lib/tuned/'下子目录中'tuned.conf'的各种系统原有配置
vi /etc/tuned/my-profile/tuned.conf

# 激活该配置
tuned-adm profile my-profile

最后更新于