Latest News : 亮瞎双眼的那些年!

Tuned – 自动优化CentOS/RHEL 伺服器的性能调优

PHP admin 743 views 0 comments

Tuned is a powerful daemon for dynamically auto-tuning Linux server performance based on information it gathers from monitoring use of system components, to squeeze maximum performance out of a server.
Tuned 是一个功能强大的守护程序,用于根据从监视系统组件使用情况中收集的信息动态自动调整 Linux 服务器性能,从而从服务器中榨取最大性能。

It does this by tuning system settings dynamically on the fly depending on system activity, using tuning profiles. Tuning profiles include sysctl configs, disk-elevators configs, transparent hugepages, power management options and your custom scripts.
它通过使用调整配置文件根据系统活动动态调整系统设置来实现此目的。调优配置文件包括 sysctl 配置、磁盘电梯配置、透明大页面、电源管理选项和自定义脚本。

By default tuned will not dynamically adjust system settings, but you can modify how the tuned daemon operates and allow it to dynamically alter settings based on system usage. You can use the tuned-adm command-line tool to manage the daemon once it is running.
默认情况下,tuned 不会动态调整系统设置,但您可以修改 tuned 守护程序的运行方式,并允许它根据系统使用情况动态更改设置。您可以使用 tuned-adm 命令行工具在守护程序运行后对其进行管理。

How to Install Tuned on CentOS/RHEL & Fedora
如何在 CentOS/RHEL 和 Fedora 上安装 Tuned

 

 

On CentOS/RHEL 7 and Fedoratuned comes pre-installed and activated by default, but on older version of CentOS/RHEL 6.x, you need to install it using the following yum command.
在 CentOS/RHEL 7 和 Fedora 上,tuned 預設並預設並啟動,但在舊版本的 CentOS/RHEL 6.x 上,你需要使用以下 yum 命令來安裝它。

# yum install tuned

After the installation, you will find following important tuned configuration files.
安装后,您将找到以下重要的调优配置文件。

  • /etc/tuned – tuned configuration directory.
    /etc/tuned – tuned 配置目录。
  • /etc/tuned/tuned-main.conf– tuned mail configuration file.
    /etc/tuned/tuned-main.conf– tuned mail 配置文件。
  • /usr/lib/tuned/ – stores a sub-directory for all tuning profiles.
    /usr/lib/tuned/ – 存储所有调优配置文件的子目录。

Now you can start or manage the tuned service using following commands.
现在,您可以使用以下命令启动或管理优化的服务。

————— On RHEL/CentOS 7 —————

 
# systemctl start tuned	        
# systemctl enable tuned	
# systemctl status tuned	
# systemctl stop tuned		

————— On RHEL/CentOS 6 —————

# service tuned start
# chkconfig tuned on
# service tuned status
# service tuned stop

Now you can control tuned using the tunde-adm tool. There are a number of predefined tuning profiles already included for some common use cases. You can check the current active profile with following command.
现在,您可以使用tunde-adm工具控制调优。对于一些常见用例,已经包含了许多预定义的调优配置文件。您可以使用以下命令检查当前活动配置文件。

# tuned-adm active

From the output of the above command, the test system (which is a Linode VPS) is optimized for running as a virtual guest.
从上述命令的输出来看,测试系统(它是一个 Linode VPS)针对作为虚拟来宾运行进行了优化。

Check Current Tuned Profile
检查当前调整的配置文件

You can get a list of available tuning profiles using following command.
可以使用以下命令获取可用优化配置文件的列表。

# tuned-adm list
List Available Tuned Profiles
列出可用的调优配置文件

To switch to any of the available profiles for example throughput-performance – a tuning which results into excellent performance across a variety of common server workloads.
切换到任何可用的配置文件,例如吞吐量性能 – 一种调整,可在各种常见的服务器工作负载中实现出色的性能。

# tuned-adm  profile throughput-performance
# tuned-adm active
Switch to Tuning Profile 切换到调整配置文件

To use the recommended profile for your system, run the following command.
要为您的系统使用推荐的配置文件,请运行以下命令。

# tuned-adm recommend

And you can disable all tuning as shown.
您可以禁用所有调整,如图所示。

 
# tuned-adm off

How To Create Custom Tuning Profiles
如何创建自定义优化配置文件

You can also create new profiles, we will create a new profile called test-performance which will use settings from an existing profile called latency-performance.
您还可以创建新的配置文件,我们将创建一个名为测试性能的新配置文件,该配置文件将使用称为延迟性能的现有配置文件中的设置。

Switch into the path which stores sub-directories for all tuning profiles, create a new sub-directory called test-performance for your custom tuning profile there.
切换到存储所有调优配置文件的子目录的路径,在那里为您的自定义调优配置文件创建一个名为 test-performance 的新子目录。

# cd /usr/lib/tuned/
# mkdir test-performance

Then create a tuned.conf configuration file in the directory.
然后在目录中创建一个 tuned.conf 配置文件。

# vim test-performance/tuned.conf

Copy and paste the following configuration in the file.
将以下配置复制并粘贴到文件中。

[main]
include=latency-performance
summary=Test profile that uses settings for latency-performance tuning profile

Save the file and close it.
保存文件并将其关闭。

If you run the tuned-adm list command again, the new tuning profile should exist in the list of available profiles.
如果再次运行 tuned-adm list 命令,则新的优化配置文件应存在于可用配置文件列表中。

# tuned-adm list
blank
Check New Tuned Profile 检查新调整的配置文件

To activate new tuned profile, issue following command.
要激活新的优化配置文件,请发出以下命令。

# tuned-adm  profile test-performance

For more information and further tinkering options, see the tuned and tuned-adm man pages.
有关更多信息和进一步的修改选项,请参见调优和调优 adm 手册页。

# man tuned
# man tuned-adm

Tuned Github repositoryhttps://github.com/fcelda/tuned
Tuned Github repository: https://github.com/fcelda/tuned

Please indicate: 无趣的人生也产生有意思的事件 » Tuned – 自动优化CentOS/RHEL 伺服器的性能调优

Hi, you must log in to comment !