Redhat tuned-adm

Installing and configuring Tuned

To start using tuned we will first need to install the packages for it:

[root@server ~]# yum install tuned

After the packages are installed we can query the status of the tuning daemons using the tuned-adm activecommand:

[root@server ~]# tuned-adm active
Current active profile: off
Service tuned: disabled, stopped
Service ktune: disabled, stopped

As we can see in the output above we haven’t yet selected a tuning profile, and both the daemons (tuned and ktune) are stopped, and not configured to start at system boot.

To view a list of available tuning profiles you can use the tuned-adm list command:

[root@server ~]# tuned-adm list
Available profiles:
– desktop-powersave
– enterprise-storage
– server-powersave
– default
– throughput-performance
– laptop-battery-powersave
– spindown-disk
– latency-performance
– laptop-ac-powersave
Current active profile: off

Let’s say that we are interested in the throughput-performance profile. Selecting a profile can be done with the tuned-adm profile command:

[root@server ~]# tuned-adm profile throughput-performance

Running the command tuned-adm active now gives us some new output:

[root@server ~]# tuned-adm active
Current active profile: throughput-performance
Service tuned: enabled, running
Service ktune: enabled, running

Not only did the tuned-adm profile command set our profile choice, it also started the daemons for us and enabled the daemons to start at boot.

If at any time you want to completely disable the tuning daemon you can do so by running the command tuned-adm off:

[root@server ~]# tuned-adm off

This will not only revert all your settings to what they were before tuned started, it will also disable the tuning services from running at boot.

With this information in mind the example in our introduction can be implemented by creating a new file in/etc/cron.d, let’s call it /etc/cron.d/tuning

0 8 * * 1-5 /usr/bin/tuned-adm profile throughput-performance
0 18 * * 1-5 /usr/bin/tuned-adm profile server-powersave

With these cron jobs in place our server will switch to a maximum throughput profile every weekday at 08:00, and back to a power saving profile weekdays at 18:00.

Creating Tuning Profiles

If you want to go beyond the nine profiles shipped with tuned you can create your own. All tuning profiles get their own sub-directory under /etc/tune-profiles, and creating a new one is as easy a copying an existing one. For example let’s say that we want to base a new profile of the the existing server-powersave profile:

[root@server ~]# cd /etc/tune-profiles
[root@server tune-profiles]#
cp -av server-powersave my-powersave

Inside your new directory you should now find four files:

  • tuned.conf: In this file you can enable/disable the three main tuned plugins (disk, network, and CPU). When enabled these plugins will monitor your system and switch to power saving mode for their respective subsystems whenever that subsystem has a low load.
  • ktune.sysconfig: In this file you can enable/disable the use of ktune and set a disk elevator to be used for your hard drives. Disk elevators are the queuing algorithms used fo re-ordering and merging requests send to a disk.
  • sysctl.ktune: In here you can change sysctl settings. Bear in mind that when a profile is activated the settings from /etc/sysctl.conf will also be applied after this file has been parsed.
  • ktune.sh: In this script you should have two functions: start() {} and stop() {}. The start function will be called when the profile is activated (also on boot), and the stop function will be called when we de-activate this profile. ktune.sh should always source the file /etc/tune-profiles/functions, which provides you with a lot of utility functions for power management, disk tuning, enabling and disabling transparent hugepages, etc. One of the most important functions in this file is process, which is usually called like process ${@} at the end of yourktune.sh script. The process function has all the default logic in it for handling starting, stopping, and restarting your profile.

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories

Get Free Shipping on Everything All Season Long
Best Buy Co, Inc.
Best Buy Co, Inc.