介绍

tuned是一项守护程序,它会使用udev来监控联网装置,并且根据选择的配置文件对系统设置进行静态和动态的微调。它有许多为常见使用案例(例如高吞吐量、低延迟或者节电)的预定义配置文件,并且允许用户更改为每个配置文件定义的规则,还可以自定义如何对一个特定的设备进行微调。若要通过某个配置文件还原系统设置的所有更改,您可以切换到另一个配置文件,或者停用tuned 守护程序。

静态微调主要包括预定义的sysctl和 sysfs 设置和对几种配置工具的单次激活,例如 ethtool。tuned还会监控系统组件的使用状况,并根据监控的信息动态地微调信息系统设置。动态微调使得在任何给定系统的运行时间内,不同的系统组件能够以不同的方式被使用。例如,在启动和登录过程中会大量使用硬盘驱动器,但是之后用户可能主要使用类似网页浏览器或者电子邮件客户端这类的应用程序,这种情况下就几乎不会使用硬盘驱动器。类似地,不同的时间对CPU 和网络设备的使用是不同的。Tuned 会监控这些组件的活动,并且对它们在使用过程中出现的改变作出反应。

项目主页:https://tuned-project.org/
开发语言:Python

环境

操作系统:Centos7
服务器:腾讯云轻量

安装及工具

安装

在centos6之后,默认已经安装了tuned,如果没有可以使用yum来安装。

[root@LWS-QHK-NODE software]# yum list | grep tuned
Repository epel is listed more than once in the configuration
tuned.noarch                             2.11.0-8.el7                  @os
tuned.noarch                             2.11.0-10.el7                 updates
tuned-gtk.noarch                         2.11.0-10.el7                 updates
tuned-profiles-atomic.noarch             2.11.0-10.el7                 updates
tuned-profiles-compat.noarch             2.11.0-10.el7                 updates
tuned-profiles-cpu-partitioning.noarch   2.11.0-10.el7                 updates
tuned-profiles-mssql.noarch              2.11.0-10.el7                 updates
tuned-profiles-oracle.noarch             2.11.0-10.el7                 updates
tuned-utils.noarch                       2.11.0-10.el7                 updates
tuned-utils-systemtap.noarch             2.11.0-10.el7                 updates
[root@LWS-QHK-NODE software]# yum -y install tuned
[root@LWS-QHK-NODE software]# systemctl start tuned         
[root@LWS-QHK-NODE software]# systemctl enable tuned   

命令工具

  • tuned:服务
  • tuned-adm 客户端工具
  • tuna:图形化策略编写工具

配置文件

[root@LWS-QHK-NODE software]# ls /etc/tuned/
active_profile  bootcmdline  profile_mode  recommend.d  tuned-main.conf

配置

常看当前配置

[root@LWS-QHK-NODE software]# tuned-adm active
Current active profile: virtual-guest

预设配置

[root@LWS-QHK-NODE software]# 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
Current active profile: virtual-guest

预设配置说明

balanced:成为性能和功耗之间的折衷。尽量使用自动调节,它有好的结果对于大多数负载。唯一的缺点是增加了延迟.
desktop:桌面模式
hpc-compute:hpc-compute模式
latency-performance:低延迟的性能模式。它禁用电能节约机制,使sysctl设置提高延迟,CPU调节器将性能低的CPU锁定C状态.
network-latency:针对确定性性能进行优化,以增加功耗为代价,重点放在低延迟网络性能上
network-throughput:针对流网络吞吐量进行优化,通常仅在较旧的CPU或40G +网络上才需要
throughput-performance:高吞吐量优化模式。它禁用电能节约机制,使sysctl设置提高吞吐量性能的磁盘、网络IO和转向最后期限的调度器,CPU调试器设置为性能模式.
virtual-guest:基于企业存储配置文件,在其他任务,增加虚拟内存swappiness和减少磁盘预读值。它没有禁用磁盘屏障。
virtual-host:针对运行KVM guest虚拟机进行优化

参考资料

文章目录