Table of Contents
In this article I will share the steps to create custom tuned profile. But before we start with the steps to create custom tuned profile, you must be aware of the basic terminologies so let me give a brief overview.
What is tuned?
Tuned is a daemon that uses udev to monitor connected devices and statically and dynamically tunes system settings according to a selected profile. Tuned is distributed with a number of predefined profiles for common use cases like high throughput, low latency, or powersave. It is possible to modify the rules defined for each profile and customize how to tune a particular device. To revert all changes made to the system settings by a certain profile, you can either switch to another profile or deactivate the tuned service.
The tuned profiles are stored in
/etc/tuned/<profile_name>/tuned.conf or in
/usr/lib/tuned/<profile_name>/tuned.conf directory. Distribution-specific profiles are stored in the
/etc/tuned/directory has higher priority.
List man pages for tuned
To list all the
man pages for tuned use the below command:
# man -k tuned tuned (8) - dynamic adaptive system tuning daemon tuned-adm (8) - commandline tool for switching between different tuning profiles tuned-main.conf (5) - Tuned global configuration file tuned-profiles (7) - description of basic tuned profiles tuned.conf (5) - Tuned profile definition
List available tuned profiles
By default a Red Hat node has multiple pre-defined profiles, to get the list of installed profiles execute below command
# tuned-adm list Available profiles: - balanced - General non-specialized tuned profile - desktop - Optimize for the desktop use-case - 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
Get tuned recommendation
To let tuned recommend you the best suitable profile for your system without changing any existing profiles and using the same logic as used during the installation, run the following command:
# tuned-adm recommend virtual-guest
Here since I am using a virtual host, the recommended profile is
Get active tuned profile
To view the currently active profile on your node
# tuned-adm active Current active profile: virtual-guest
So here my currently active profile is
virtual-guest which also was the recommended profile.
Tuned's RPM spec file intentionally does not mark profile tuned.conf files as local configuration files. This means that if you were to adjust profiles that are included with tuned, any local updates to tuned.conf files will be overwritten when you update the tuned RPM. Because of this, Red Hat recommends that you avoid making local changes to the profiles that Red Hat ships (
/usr/lib/tuned), and instead create a new profile inside (
Steps to create custom tuned profile
Create a directory inside
/etc/tuned/ with a custom name
# mkdir /etc/tuned/golinuxcloud
Next create a
tuned profile. Below is my sample tuned profile
# vim /etc/tuned/golinuxcloud/tuned.conf [main] summary=This is a test tuned profile [cpu] force_latency=1 [vm] transparent_hugepages=never [sysctl] kernel.sysrq=1 vm.nr_hugepages=4100 kernel.numa_balancing=0 [script] script=/etc/tuned/golinuxcloud/myscript.sh
Here I have created a custom tuned profile which performs below list of functions
- limit C-state usage to C1
- disable transparent hugepages
- allocate 4100 2MB static hugepages
- disable automatic numa balancing
- run an arbitrary shell script
myscript.shis a demo script which you can replace with your script.
Provide executable permission to the tuned profile
# chmod +x /etc/tuned/golinuxcloud/tuned.conf
Next enable the new profile
# tuned-adm profile golinuxcloud
Check the currently active profile
# tuned-adm active Current active profile: golinuxcloud
So our profile is successfully active.
To make sure you can also check if your config is also loaded
# cat /sys/kernel/mm/transparent_hugepage/enabled always madvise [never]
So as you see the transparent huge page is disabled.
Disable tuned profile
To disable tuned profile
# tuned-adm off
Follow the Performance Guide from Red Hat 7 to get more details on tuned.
Lastly I hope the steps from the article to create custom tuned profile on Linux was helpful. So, let me know your suggestions and feedback using the comment section.