Linux性能优化特性Tuned和ktune(2)

Tuned本质上是一个Linux环境中的后台进程,在运行过程中依据配置内容监控调整系统。监控程序会根据监控的配置内容,监控进程会持续监控结果反馈,调整优化策略。Ktune进程是在Red Hat 5.3引入的一项架构服务内容,为一些特定的用例场景来优化进程。

[root@SICS-MIGPC-DB ~]# ps -ef | grep tune

root    18878 18856  0 13:36 pts/0    00:00:00 grep tune

root    31656    1  0 Apr07 ?        00:00:00 /usr/bin/python /usr/sbin/tuned -d -c /etc/tuned.conf

tuned程序是后台运行的守护进程,-c参数用于指定当前的监控参数。

[root@SICS-MIGPC-DB tune-profiles]# cat /etc/tuned.conf
# disable tuned
[main]
[DiskMonitor]
enabled=False
[DiskTuning]
enabled=False
[NetMonitor]
enabled=False
[NetTuning]
enabled=False
[CPUMonitor]
enabled=False
[CPUTuning]
enabled=False

作为后台的进程tuned命令,是可以通过chkconfig和service命令进行配置启动的。

[root@SICS-MIGPC-DB ~]# service tuned status

tuned (pid  31656) is running...

tuned-adm命令是管理tuned组件的主要接口。

[root@SICS-MIGPC-DB ~]# tuned-adm help

Usage: tuned-adm <command>

commands:

help                          show this help message and exit

list                          list all available and active profiles

active                        show current active profile

off                            switch off all tuning

profile <profile-name>        switch to given profile

通过list命令,可以查看当前应用和备选的所有Profile内容。

[root@SICS-MIGPC-DB ~]# tuned-adm list
Available profiles:
- laptop-battery-powersave
- virtual-guest
- enterprise-storage
- desktop-powersave
- default
- throughput-performance
- spindown-disk
- sap
- enterprise-storage-no-thp
- laptop-ac-powersave
- virtual-host
- server-powersave
- latency-performance
Current active profile: enterprise-storage-no-thp

通过tuned-adm命令的profile参数,可以保证系统动态的进行调整参数。

[root@SICS-MIGPC-DB tune-profiles]# tuned-adm profile desktop-powersave
Reverting to saved sysctl settings: [  OK  ]
Calling '/etc/ktune.d/tunedadm.sh stop': [  OK  ]
Reverting to cfq elevator: dm-0 dm-1 dm-2 sda [  OK  ]
Stopping tuned: [  OK  ]
Switching to profile 'desktop-powersave'
Applying ktune sysctl settings:
/etc/ktune.d/tunedadm.conf: [  OK  ]
Calling '/etc/ktune.d/tunedadm.sh start': [  OK  ]
Applying sysctl settings from /etc/sysctl.conf
Starting tuned: [  OK  ]

从执行过程,可以看到系统不断的进行参数sysctl.conf调整应用。注意:/etc/tuned.conf内容也发生了变化。表明Profile的修改变化和Tuned行为变化。

[root@SICS-MIGPC-DB tune-profiles]# cat /etc/tuned.conf
#
# tuned configuration main service
#
[main]
# Interval for monitoring and tuning. Default is 10s.
# interval=10
#
# Disk monitoring section
#
[DiskMonitor]
# Enabled or disable the plugin. Default is True. Any other value
# disables it.
# enabled=False
#
# Disk tuning section
#
[DiskTuning]
# Enabled or disable the plugin. Default is True. Any other value
# disables it.
# enabled=False
# hdparm=False
# alpm=False
#
# Net monitoring section
#
[NetMonitor]
# Enabled or disable the plugin. Default is True. Any other value
# disables it.
# enabled=False
#
# Net tuning section
#
[NetTuning]
# Enabled or disable the plugin. Default is True. Any other value
# disables it.
# enabled=False
#
# CPU monitoring section
#
[CPUMonitor]
# Enabled or disable the plugin. Default is True. Any other value
# disables it.
# enabled=False
#
# CPU tuning section
#
[CPUTuning]
# Enabled or disable the plugin. Default is True. Any other value
# disables it.
# enabled=False

3、Profile内部信息

下面我们深入单个Profile的内部,探索一下内部的工作结构。在/etc/tune-profiles目录中,每个目录对应一个Profile内容。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/16287.html