一、Tuned简介
Tuned是Red Hat Linux操作系统自带的性能调优工具,通过针对特定应用场景提供配置来改善系统性能,自Red Hat Enterprise Linux/CentOS的6.3版本开始出现,包括两部分tuned和tuned-adm,其中tuned是服务端程序,用来监控和收集系统各个组件的数据,并依据数据提供的信息动态调整系统设置,达到动态优化系统的目的;tuned-adm 是客户端程序。
tuned主要特点如下:
- tuned是一个服务进程,可根据系统使用情况,自动动态调整Linux的设定,以提升性能。
- 自动动态调整设定取决于系统活动及使用的调整配置文件。
- 在默认情况下,tuned不会动态调整系统设置,而是通过修改tuned服务程序的运行方式,来根据系统使用情况动态更改设置。
- 一般使用tuned-adm 命令工具管理服务程序的运行。
二、Tuned安装简介
软件包安装命令:dnf install tuned
安装完成后,有以下几个主要文件目录:
●/etc/tuned:配置目录文件,其中/etc/tuned-main.conf 是主配置文件。
●/usr/lib/tuned:所有配置文件的存储目录,包括如下配置文件。
balanced:一般用户调整后的配置文件,比较平衡。
desktop:主要针对桌面应用进行优化的配置文件。
hpc-compute:针对HPC计算工作负载进行了优化的配置文件。
throughput-performance:侧重于吞吐量。
latency-performance:侧重于低延迟的模式。
network-throughput:侧重于网络吞吐量的模式。
network-latency:侧重于更低的网络延迟的模式。
virtual-host:侧重于优化虚拟主机的模式。
virtual-guest:侧重于优化虚拟客户端的模式。
powersave:针对低功耗进行优化,强制 CPU 尽可能使用最低的频率。
三、Tuned常用操作命令
[root@servera student]# systemctl start tuned.service
[root@servera student]# systemctl status tuned.service
[root@servera student]# systemctl stop tuned.service
tuned-adm active
Current active profile: virtual-guest
[root@servera student]# tuned-adm recommend
virtual-guest
[root@servera student]# tuned-adm profile //查看可选优化方案
balanced latency-performance network-throughput recommend.d virtual-guest
desktop network-latency powersave throughput-performance virtual-host[root@servera student]# tuned-adm profile virtual-guest
[root@servera student]# tuned-adm off
[root@servera student]# tuned-adm list
Available profiles:
- balanced - General non-specialized tuned profile
- desktop - Optimize for the desktop use-case
- 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
No current active profile.
[root@servera student]# tuned-adm active //tuned-adm active激活也提示没有配置方案,需要重新通过 tuned-adm profile命令配置
No current active profile.
四、Tuned操作实验:
为您的系统选择建议的tuned配置,并将它设置为默认设置
1、tuned-adm list 查看可选方案和当前状态
[student@servera ~]$ tuned-adm list
Available profiles:
- balanced - General non-specialized tuned profile
- desktop - Optimize for the desktop use-case
- 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
Current active profile: virtual-guest //当前调优状态** COLLECTED WARNINGS **
Failed to open memory buffer (/dev/mem): Permission denied
No SMBIOS nor DMI entry point found, sorry.
** END OF WARNINGS **
2、tuned-adm recommend 查看推荐方案
[root@servera student]# tuned-adm recommend //查看推荐方案
virtual-guest
3、tuned-adm profile 配置推荐方案
[root@servera student]# tuned-adm profile virtual-guest