Deploying Automatic System Tuning on Red Hat Linux
With the promotion and application of open platform, the open operating system platform represented by Linux has become the preferred choice of system architecture. As a mature operating system, system monitoring optimization is an essential tool component of the Linux platform. After multiple versions of Linux, mature operating system configuration optimization policies have been developed.
This article mainly introduces the Automatic System Tuning package in the Red Hat Linux environment. Different Application Profile policies are used for different Linux scenarios.
1. Environment Introduction
The operating system environment of the author is Red Hate 6.4. The current Linux operating system can support various types of systems ranging from personal desktop servers to large system cluster environments. For example, enterprise storage servers and high network throughput servers.
[Root @ SICS-MIGPC-DB ~] # Cat/etc/RedHat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)
2. Tuned Installation
First, you can use yum to install the program of the Automatic System Tuning package. Yum can automatically help us solve many problems such as package dependency and version selection. It is a limited option for installation and configuration.
Yum has different options for different Linux releases. Red Hat Linux has strict requirements. You can download the latest rpm package from the website only after you have registered official service support. For open-source versions such as CentOS, the yum tool has fewer restrictions. My usual practice is to create a local yum resource library, put the rpm package in the Linux installation disk in the resource library, and install it as needed.
[Root @ SICS-MIGPC-DB ~] # Yum install tuned
Loaded plugins: product-id, refresh-packagekit, security, subrole-manager
This system is not registered to Red Hat sub‑management. You can use sub‑manager to register.
Localyum | 2.9 kB...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tuned. noarch 0: 0. 2.19-13. el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================== ==========================================================
Package Arch Version Repository Size
========================================================== ==========================================================
Installing:
Tuned noarch 0.2.19-13. el6 localyum 94 k
Transaction Summary
========================================================== ==========================================================
Install 1 Package (s)
Total download size: 94 k
Installed size: 222 k
Is this OK [y/N]: yes
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: tuned-0.2.19-13.el6.noarch 1/1
Verifying: tuned-0.2.19-13.el6.noarch 1/1
Installed:
Tuned. noarch. 2.19-13. el6
Complete!
After installation, tuned is configured into the system as a system service.
[Root @ SICS-MIGPC-DB ~] # Chkconfig -- list | grep tuned
Tuned 0: off 1: off 2: off 3: off 4: off 5: off 6: off
[Root @ SICS-MIGPC-DB ~] # Chkconfig tuned on
[Root @ SICS-MIGPC-DB ~] # Chkconfig -- list | grep tuned
Tuned 0: off 1: off 2: on 3: on 4: on 5: on 6: off
3. Use tuned Configuration
You can use the service command to view the status of the tuned service and start and close it.
[Root @ SICS-MIGPC-DB ~] # Service tuned status
Tuned is stopped
[Root @ SICS-MIGPC-DB ~] # Service tuned start
Starting tuned: [OK]
In the/etc/tune-profiles directory, We can find various preset Profile files.
[Root @ SICS-MIGPC-DB tune-profiles] # cd/etc/tune-profiles/
[Root @ SICS-MIGPC-DB tune-profiles] # ls-l
Total 64
-Rw-r -- 1 root 7 Jul 24 2013 active-profile
Drwxr-xr-x 2 root 4096 Apr 3 default
Drwxr-xr-x 2 root 4096 Apr 3 13:11 desktop-powersave
Drwxr-xr-x 2 root 4096 Apr 3 13:11 enterprise-storage
-Rw-r -- 1 root 9779 Jul 24 2013 functions
Drwxr-xr-x 2 root 4096 Apr 3 laptop-ac-powersave
Drwxr-xr-x 2 root 4096 Apr 3 laptop-battery-powersave
Drwxr-xr-x 2 root 4096 Apr 3 latency-performance
Drwxr-xr-x 2 root 4096 Apr 3 sap
Drwxr-xr-x 2 root 4096 Apr 3 13:11 server-powersave
Drwxr-xr-x 2 root 4096 Apr 3 spindown-disk
Drwxr-xr-x 2 root 4096 Apr 3 throughput-performance
Drwxr-xr-x 2 root 4096 Apr 3 virtual-guest
Drwxr-xr-x 2 root 4096 Apr 3 13:11 virtual-host
These include energy-saving laptops, SAP systems, and virtual hosts. They are all predefined templates provided by Linux.
The following can be modified to the desired version based on the existing configuration template. I want to configure a Profile that does not use the Linux Huge Page feature.
[Root @ SICS-MIGPC-DB tune-profiles] # ls-l | grep enter
Drwxr-xr-x 2 root 4096 Apr 3 13:11 enterprise-storage
Drwxr-xr-x 2 root 4096 Apr 3 enterprise-storage-no-thp
Enter the directory:
[Root @ SICS-MIGPC-DB tune-profiles] # cd enterprise-storage-no-thp/
[Root @ SICS-MIGPC-DB enterprise-storage-no-thp] # ls-l
Total 16
-Rwxr-xr-x 1 root 314 Apr 3 ktune. sh
-Rw-r -- 1 root 1239 Apr 3 ktune. sysconfig
-Rw-r -- 1 root 1562 Apr 3 sysctl. ktune
-Rw-r -- 1 root 191 Apr 3 tuned. conf
Modify configuration content:
[Root @ SICS-MIGPC-DB enterprise-storage-no-thp] # sed-ie's, set_transparent_hugepages always, set_transparent_hugepages never ', /etc/tune-profiles/enterprise-storage-no-thp/ktune. sh
[Root @ SICS-MIGPC-DB enterprise-storage-no-thp] # grep set_transparent_hugepages ktune. sh
Set_transparent_hugepages never
Activate the configured Profile and apply the settings.
[Root @ SICS-MIGPC-DB enterprise-storage-no-thp] # tuned-adm profile enterprise-storage-no-thp
Stopping tuned: [OK]
Switching to profile 'enterprise-storage-no-thp'
Applying deadline elevator: dm-0 dm-1 dm-2 sda [OK]
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]
[Root @ SICS-MIGPC-DB enterprise-storage-no-thp] #
Determine whether to use the Huge Page parameter settings.
[Root @ SICS-MIGPC-DB enterprise-storage-no-thp] # cat/sys/kernel/mm/redhat_transparent_hugepage/enabled
Always [never]
To restore the default settings, you only need to disable the tuned service.
[Root @ SICS-MIGPC-DB etc] # service -- status-all | grep tun
Current ktune sysctl settings:
Tuned (pid 32429) is running...
The ps-ef command shows the background processes and parameters used.
[Root @ SICS-MIGPC-DB ~] # Ps-ef | grep tun
Root 322 32642 0 00:00:00 pts/0 grep tun
Root 32429 1 0 13:46? 00:00:00/usr/bin/python/usr/sbin/tuned-d-c/etc/tuned. conf
It can be seen from the parameter file/etc/tuned. conf used by the tuned execution that the tool has the monitoring function.
[Root @ SICS-MIGPC-DB etc] # cat tuned. conf
# Disable tuned
[Main]
[DiskMonitor]
Enabled = False
[DiskTuning]
Enabled = False
[NetMonitor]
Enabled = False
[NetTuning]
Enabled = False
[CPUMonitor]
Enabled = False
[CPUTuning]
Enabled = False
The tuned-adm tool allows you to configure and enable Profile files and information.
[Root @ SICS-MIGPC-DB ~] # Tuned-adm help
Usage: tuned-adm <command>
Commands:
Help show this help message and exit
List all available and active profiles
Active show current active profile
Off switch off all tuning
Profile <profile-name> switch to given 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
4. Conclusion
In the current environment, there are already many ready-made tools and means from the perspective of operation and maintenance. Mastering appropriate methodologies and tools and applying the right tools on the right occasions is a capability that our O & M personnel should possess.
This article permanently updates the link address: