Chapter 2. Optimizing system performance with TuneD
TuneD is a system tuning service designed to optimize system performance and power consumption by using predefined or custom profiles. It includes predefined profiles suited for different workloads, such as high throughput, low latency, and power saving.
2.1. TuneD profiles distributed with RHEL
During installation, TuneD automatically selects the most suitable profile based on the system type. For example, the throughput-performance is selected for compute nodes, virtual-guest is selected for virtual machines, and balanced is selected for general systems, ensuring optimal performance tailored to the environment. Profiles are divided mainly into two categories: power-saving profiles that reduce power consumption with minimal performance impact, and performance-boosting profiles that optimize system resources for improved speed and responsiveness.
Following is the list of notable profiles distributed with RHEL to select based on the system load:
balanced
- It is the default power-saving profile and is intended to be a compromise between performance and power consumption. It uses auto-scaling and auto-tuning whenever possible.
powersave
It is a profile for maximum power saving performance and can throttle the performance to minimize the actual power consumption. It enables USB autosuspend, Wi-Fi power saving, and Aggressive Link Power Management (ALPM) power savings for SATA host adapters, and also schedules multi-core power savings for systems with a low wakeup rate and activates the
ondemand
governor. It enables AC97 audio power saving or, depending on your system, HDA-Intel power savings with a 10 seconds timeout. If your system contains a supported Radeon graphics card with enabled KMS, the profile configures it to automatic power saving. It changes theenergy_performance_preference
attribute to thepowersave
orpower energy
setting. It also changes thescaling_governor
policy attribute to either theondemand
orpowersave
CPU governor.NoteIn some cases, the balanced profile is more efficient than powersave. For tasks such as video transcoding, running at full power completes the job faster, allowing the machine to idle and switch to efficient power-saving modes sooner. Throttling the machine reduces power during the task but extends its duration, potentially increasing overall energy use. Thus, the balanced profile is often a better choice.
throughput-performance
-
A server profile optimized for high throughput that disables power savings mechanisms and enables
sysctl
settings that improve the throughput performance of the disk and network IO. accelerator-performance
-
A profile that contains the same tuning as the
throughput-performance
profile. Additionally, it locks the CPU to low C states so that the latency is less than 100us. This improves the performance of certain accelerators, such as GPUs. latency-performance
-
A server profile optimized for low latency and disables power savings mechanisms and enables
sysctl
settings that improve latency. CPU governor is set to performance and the CPU is locked to the low C states (by PM QoS). network-latency
-
A profile for low latency network tuning. It is based on the
latency-performance
profile. It additionally disables transparent huge pages and NUMA balancing, and tunes several other network-related sysctl parameters. hpc-compute
-
A profile optimized for high-performance computing. It is based on the
latency-performance
profile. network-throughput
-
A profile for throughput network tuning. It is based on the
throughput-performance
profile. It additionally increases kernel network buffers. virtual-guest
-
A profile designed for Red Hat Enterprise Linux virtual machines and VMWare guests based on the
throughput-performance
profile that, among other tasks, decreases virtual memory swappiness and increases disk readahead values. It does not disable disk barriers. virtual-host
-
A profile designed for virtual hosts based on the
throughput-performance
profile that, among other tasks, decreases virtual memory swappiness, increases disk readahead values, and enables a more aggressive value of dirty pages writeback. oracle
-
A profile optimized for Oracle database loads based on the
throughput-performance
profile. It additionally disables transparent huge pages and modifies other performance-related kernel parameters. This profile is provided by the tuned-profiles-oracle package. desktop
-
A profile optimized for desktops, based on the
balanced
profile. It additionally enables scheduler autogroups for better response of interactive applications. optimize-serial-console
A profile that tunes down I/O activity to the serial console by reducing the printk value. This should make the serial console more responsive. This profile is intended to be used as an overlay on other profiles. For example:
tuned-adm profile throughput-performance optimize-serial-console
# tuned-adm profile throughput-performance optimize-serial-console
Copy to Clipboard Copied! mssql
-
A profile provided for Microsoft SQL Server. It is based on the
throughput-performance
profile. intel-sst
A profile optimized for systems with user-defined Intel Speed Select Technology configurations. This profile is intended to be used as an overlay on other profiles. For example:
tuned-adm profile cpu-partitioning intel-sst
# tuned-adm profile cpu-partitioning intel-sst
Copy to Clipboard Copied!
2.2. Real-time TuneD profiles distributed with RHEL
RHEL ships some profiles specifically for systems running the real-time kernel. Without a special kernel build, they do not configure the system to be real-time. On RHEL, the profiles are available with additional repositories.
realtime
-
Use on bare metal real-time systems. This is provided by the
tuned-profiles-realtime
package, which is available from the RT or NFV repositories. realtime-virtual-host
-
Use in a virtualization host configured for real-time. This is provided by the
tuned-profiles-nfv-host
package, which is available from the NFV repository. realtime-virtual-guest
-
Use in a virtualization guest configured for real-time. This is provided by the
tuned-profiles-nfv-guest
package, which is available from the NFV repository.
2.3. Installing and enabling TuneD
As a system administrator, you can use the TuneD
daemon to optimize the performance profile of your system for a variety of use cases. You must install and enable TuneD to start using it.
After installation, the /usr/lib/tuned/profiles
directory stores distribution-specific profiles. Each profile is stored in its own subdirectory. The profile includes the profile configuration file, named tuned.conf
and optionally other files, such as helper scripts. Also, to customize a profile, copy the profile directory into /etc/tuned/profiles
, which stores the files related to the custom profiles. In cases where profiles with the same name exist, the custom profile located in /etc/tuned/profiles
takes precedence.
Prerequisites
- You have administrative privileges.
Procedure
Install the TuneD package:
dnf install tuned
# dnf install tuned
Copy to Clipboard Copied! Enable and start the TuneD service:
systemctl enable --now tuned
# systemctl enable --now tuned
Copy to Clipboard Copied! Optional: Install TuneD profiles for real-time systems:
For the TuneD profiles for real-time systems enable the
rhel-10
repository.subscription-manager repos --enable=rhel-10-for-x86_64-nfv-beta-rpms dnf install tuned-profiles-realtime tuned-profiles-nfv
# subscription-manager repos --enable=rhel-10-for-x86_64-nfv-beta-rpms # dnf install tuned-profiles-realtime tuned-profiles-nfv
Copy to Clipboard Copied!
Verification
Verify that the profile is active and applied:
tuned-adm active tuned-adm verify
$ tuned-adm active Current active profile: throughput-performance $ tuned-adm verify Verification succeeded, current system settings match the preset profile. See tuned log file ('/var/log/tuned/tuned.log') for details.
Copy to Clipboard Copied!
2.4. Managing TuneD profiles
You can manage TuneD profiles in your Red Hat Enterprise Linux system, including listing available profiles, setting a specific profile, and disabling TuneD when necessary. Proper management of profiles optimizes system performance for specific workloads, such as using the cpu-partitioning profile for low-latency applications.
Prerequisites
- You have installed and enabled TuneD.
- You have administrative privileges.
Procedure
List all the available predefined TuneD profiles:
tuned-adm list
$ tuned-adm list
Copy to Clipboard Copied! Optional: To let TuneD recommend the most suitable profile for your system, use the following command:
tuned-adm recommend
# tuned-adm recommend throughput-performance
Copy to Clipboard Copied! Activate the profile:
tuned-adm profile selected-profile
# tuned-adm profile selected-profile
Copy to Clipboard Copied! Alternatively, you can activate a combination of multiple profiles:
tuned-adm profile selected-profile1 selected-profile2
# tuned-adm profile selected-profile1 selected-profile2
Copy to Clipboard Copied! View the current active TuneD profile on your system:
tuned-adm active
# tuned-adm active Current active profile: selected-profile
Copy to Clipboard Copied! Disable all tunings temporarily:
tuned-adm off
# tuned-adm off The tunings are applied again after the TuneD service restarts.
Copy to Clipboard Copied! Optional: Stop and disable the TuneD service permanently:
systemctl disable --now tuned
# systemctl disable --now tuned
Copy to Clipboard Copied!
2.5. Profile inheritance and variables for profile customization
TuneD supports profile inheritance, variable usage, and built-in functions to create new or modify existing profiles efficiently.
The pre-installed and custom profiles are available in the following directories:
-
Pre-installed profiles: Located in
/usr/lib/tuned/profiles/
Custom profiles: Created in
/etc/tuned/profiles/
- Profile Inheritance
TuneD profiles can inherit settings from other profiles by using the include option in the [main] section. Profile inheritance means a child profile inherits all settings from its parent but can override or add new parameters based on the custom requirements. For example, to create a profile based on the balanced profile, which additionally sets ALPM to the min_power instead of the medium_power, which is originally set by the balanced profile, use:
[main] include=balanced [scsi_host] alpm=min_power
[main] include=balanced [scsi_host] alpm=min_power
Copy to Clipboard Copied! - Variables’ usage while customizing profiles
You can define variables while customizing profiles. Variables help to simplify configurations by reducing repetitive definitions. You can define your own variables by creating the
[variables]
section in a profile and by using:[variables] variable_name=value
[variables] variable_name=value
Copy to Clipboard Copied! To expand the value of a variable in a profile, use:
${variable_name}
${variable_name}
Copy to Clipboard Copied! You can also store the variables in different files and use these variables while customizing profiles by adding the filepath to the variable file. For example, you can add the following lines to configuration file to consider variables from the separate file:
tuned.conf: [variables] include=/etc/tuned/my-variables.conf [bootloader] cmdline=isolcpus=${isolated_cores}
tuned.conf: [variables] include=/etc/tuned/my-variables.conf [bootloader] cmdline=isolcpus=${isolated_cores}
Copy to Clipboard Copied! Where
isolated_cores=1,2
is added in my-variable.conf file as follows:
my-variable.conf: isolated_cores=1,2
my-variable.conf: isolated_cores=1,2
Copy to Clipboard Copied!
2.6. Built-in functions for profile customization
You can use the built-in functions in TuneD profiles to dynamically expand at runtime when a profile is activated. Use built-in functions with TuneD variables to modify and process values dynamically within a profile. Additionally, you can extend TuneD with custom functions by creating and integrating custom Python functions as plugins.
Syntax to start a built-in function:
${f:function_name:argument_1:argument_2}
${f:function_name:argument_1:argument_2}
Also, to retrieve the directory path where the profile and the tuned.conf file are located, use the PROFILE_DIR
variable, which requires the following syntax:
${i:PROFILE_DIR}
${i:PROFILE_DIR}
Example of isolating CPU cores by using a built-in function:
[variables] non_isolated_cores=0,3-5 [bootloader] cmdline=isolcpus=${f:cpulist_invert:${non_isolated_cores}}
[variables]
non_isolated_cores=0,3-5
[bootloader]
cmdline=isolcpus=${f:cpulist_invert:${non_isolated_cores}}
In this example, the ${non_isolated_cores}
variable expands to 0,3-5
. The cpulist_invert
function inverts the CPU list. On a system with 6 CPUs, 0,3-5
inverts to 1,2
, resulting in the kernel booting with the isolcpus=1,2
option.
Function name | Description |
---|---|
assertion | Compare two arguments. If they do not match, the function logs text from the first argument and aborts profile loading. |
assertion_non_equal | Compare two arguments. If they match, the function logs text from the first argument and aborts profile loading. |
calc_isolated_cores | Calculates and returns isolated cores. The argument specifies how many cores per socket to reserve for housekeeping. If not specified, one core per socket is reserved for housekeeping and the rest are isolated. |
check_net_queue_count | Checks whether the user has specified a queue count for net devices. If not, it returns the number of housekeeping CPUs. |
cpuinfo_check | Checks regular expressions against /proc/cpuinfo. Accepts arguments in the form: REGEX1, STR1, REGEX2, STR2, …[, STR_FALLBACK]. If REGEX1 matches something in /proc/cpuinfo, it expands to STR1; if REGEX2 matches, it expands to STR2. It stops on the first match. If no regular expression matches, it expands to STR_FALLBACK or an empty string if no fallback is provided. |
cpulist2devs | Converts a CPU list to device strings. |
cpulist2hex | Converts a CPU list to a hexadecimal CPU mask. |
cpulist2hex_invert | Converts a CPU list to a hexadecimal CPU mask and inverts it. |
cpulist_invert | Inverts a list of CPUs to make its complement. For example, on a system with 4 CPUs (0-3), the inversion of the list 0,2,3 is 1. |
cpulist_online | Checks whether the CPUs from the list are online. Returns the list containing only online CPUs. |
cpulist_pack | Packs a CPU list in the form of 1,2,3,5 to 1-3,5. |
cpulist_present | Checks whether the CPUs from the list are present. Returns the list containing only present CPUs. |
cpulist_unpack | Unpacks a CPU list in the form of 1-3,4 to 1,2,3,4. |
exec | Executes a process and returns its output. |
hex2cpulist | Converts a hexadecimal CPU mask to a CPU list. |
intel_recommended_pstate |
Checks the processor code name and returns the recommended |
iscpu_check |
Checks regular expressions against the output of |
package2cpus | Provides a CPU device list for a package (socket). |
package2uncores | Provides an uncore device list for a package (socket). |
regex_search_ternary |
Ternary regular expression operator. Takes arguments in the form: STR1, REGEX, STR2, STR3. If REGEX matches STR1 ( |
log | Expands to the concatenation of arguments and logs the result, useful for debugging. |
kb2s | Converts KB to disk sectors. |
s2kb | Converts disk sectors to KB. |
strip | Creates a string from all passed arguments and deletes both leading and trailing white spaces. |
virt_check | Checks whether TuneD is running inside a virtual machine (VM) or on bare metal. Inside a VM, the function returns the first argument. On bare metal, the function returns the second argument, even in case of an error. |
2.7. TuneD plugins
TuneD profiles use plugins to monitor or optimize different devices on the system. TuneD uses two types of plugins:
- Monitoring plugins
- Used for gathering system data such as, CPU load, disk I/O, and network traffic. The output of the monitoring plugins can be used by tuning plugins for dynamic tuning. Monitoring plugins are automatically instantiated whenever their metrics are needed by any of the enabled tuning plugins. The available monitoring plugins are:
disk
- Gets disk load (number of IO operations) per device and measurement interval.
net
- Gets network load (number of transferred packets) per network card and measurement interval.
load
- Gets CPU load per CPU and measurement interval.
- Tuning plugins
- Each tuning plugin tunes an individual subsystem and takes several parameters that are populated from the TuneD profiles. Each subsystem can have multiple devices, such as multiple CPUs or network cards, handled by individual instances of the tuning plugins. Specific settings for individual devices are also supported. The available tuning plugins are:
acpi
-
Configures the ACPI driver. Use the
platform_profile
option to set the ACPI platform profilesysfs
attribute. It is a genericpower/performance
preference API for other drivers. Multiple profiles can be specified, separated by|
. The first available profile is selected. audio
-
Sets the autosuspend timeout for audio codecs to the value specified by the timeout option. Currently, the
snd_hda_intel
andsnd_ac97_codec
codecs are supported. The value 0 means that autosuspend is disabled. You can also enforce the controller reset by setting the Boolean option reset_controller totrue
. bootloader
-
Adds options to the kernel command line. This plugin supports only the GRUB boot loader. Customized non-standard location of the GRUB configuration file can be specified by the
grub2_cfg_file
option. The kernel options are added to the current GRUB configuration and its templates. The system needs to be rebooted for the kernel options to take effect. cpu
- Manages CPU governor and power settings by setting the CPU governor to the value specified by the governor option and dynamically changing the Power Management Quality of Service (PM QoS) CPU Direct Memory Access (DMA) latency according to the CPU load.
disk
-
Manages disk settings such as
apm
,scheduler_quantum
,readahead
,readahead_multiply
,spindown
. eeepc_she
- Dynamically sets the front-side bus (FSB) speed according to the CPU load.
irq
-
Handles individual interrupt requests (IRQ) as devices and multiple plugin instances can be defined, each addressing different devices or irqs. The device names used by the plugin are
irq<n>
, where<n>
is the IRQ number. The special deviceDEFAULT
controls values written to/proc/irq/default_smp_affinity
, which applies to all non-active IRQs. irqbalance
-
Manages settings for
irqbalance
. The plugin configures CPUs which should be skipped when rebalancing IRQs in/etc/sysconfig/irqbalance
. It then restarts irqbalance only if it was previously running. modules
-
Applies custom kernel modules options. It can set parameters to kernel modules and creates
/etc/modprobe.d/tuned.conf
file. The syntax ismodule=option1=value1 option2=value2…
wheremodule
is the module name andoptionx=valuex
are module options which might be present. mounts
- Enables or disables barriers for mounted filesystems.
net
- Configures Wake-on-LAN and interface speed by using the same syntax as the ethtool utility. Also, dynamically changes the interface speed according to the interface utilization.
rtentsk
- Avoids inter-processor interruptions caused by enabling or disabling static keys. It has no options. When included, TuneD keeps an open socket with timestamping enabled, thus keeping the static key enabled.
selinux
-
Tunes SELinux options. SELinux decisions, such as allowing or denying access, are cached. This cache is known as the Access Vector Cache (AVC). When using these cached decisions, SELinux policy rules need to be checked less, which increases performance. The
avc_cache_threshold
option allows adjusting the maximum number of AVC entries. systemd
-
Tunes systemd options. The
cpu_affinity
option allows setting CPUAffinity in/etc/systemd/system.conf
. This configures the CPU affinity for the service manager and the default CPU affinity for all forked off processes. Add a comma-separated list of CPUs with optional CPU ranges specified by the minus sign (-
). scsi_host
-
Tunes SCSI host settings (for example,
ALPM
). scheduler
- Offers a variety of options for the tuning of scheduling priorities, CPU core isolation, and process, thread, and IRQ affinities.
script
- Runs external script or binary when loading or unloading a profile.
service
- Handles various sysvinit, sysv-rc, openrc, and systemd services specified by the plugin options. Supported service handling commands are start, stop, enable, and disable.
sysctl
-
Modifies kernel parameters. Use this plugin only if you want to change system settings that are not covered by other plugins available in TuneD. The syntax is name=value, where name is the same as the name provided by the
sysctl
utility. sysfs
-
Sets various
sysfs
settings specified by the plugin options. The syntax is name=value, where name is thesysfs
path to use. usb
-
Adjusts USB autosuspend timeout. The value
0
means that autosuspend is disabled. uncore
-
Limits the maximum and minimum uncore frequency. The options
max_freq_khz
,min_freq_khz
correspond tosysfs
files exposed by Intel uncore frequency driver. Their values can be specified in kHz or as a percentage of their configurable range. video
-
Sets various powersave levels on video cards. Currently, only the
Radeon
cards are supported. Thepowersave
level can be specified by using theradeon_powersave
option. Supported values are, default, auto, low, mid, high, dynpm, dpm-battery, dpm-balanced, and dpm-perfomance. vm
-
Enables or disables transparent huge pages. Valid values for the transparent_hugepages option are:
always, never, madvise
.
2.8. Creating a new TuneD profile
You can create a new TuneD profile to customize your requirements for performance optimization.
Prerequisites
- The TuneD service is running. See Installing and Enabling TuneD for details.
Procedure
In the /etc/tuned/profiles directory, create a new directory named the same as the profile that you want to create:
mkdir /etc/tuned/profiles/my-profile
# mkdir /etc/tuned/profiles/my-profile
Copy to Clipboard Copied! -
In the new directory, create a file named
tuned.conf
. Edit the file and add a [main] section and plug in definitions in it, according to your requirements. For example, see the configuration of the
balanced
profile:[main] summary=General non-specialized TuneD profile [cpu] governor=conservative energy_perf_bias=normal [audio] timeout=10 [video] radeon_powersave=dpm-balanced, auto [scsi_host] alpm=medium_power
[main] summary=General non-specialized TuneD profile [cpu] governor=conservative energy_perf_bias=normal [audio] timeout=10 [video] radeon_powersave=dpm-balanced, auto [scsi_host] alpm=medium_power
Copy to Clipboard Copied! Activate the profile.
tuned-adm profile my-profile
# tuned-adm profile my-profile
Copy to Clipboard Copied!
Verification
View the profile is active and applied:
tuned-adm active tuned-adm verify
$ tuned-adm active Current active profile: my-profile $ tuned-adm verify Verification succeeded, current system settings match the preset profile. See tuned log file ('/var/log/tuned/tuned.log') for details.
Copy to Clipboard Copied!
2.9. Modifying an existing TuneD profile
You can modify the parameters of an existing profile to suit your custom requirements. A modified child profile can be created based on an existing TuneD profile.
Prerequisites
- The TuneD service is running. See Installing and Enabling TuneD for details.
Procedure
In the
/etc/tuned/profiles
directory, create a new directory named the same as the profile that you want to create:mkdir /etc/tuned/profiles/modified-profile
# mkdir /etc/tuned/profiles/modified-profile
Copy to Clipboard Copied! In the new directory, create a file named
tuned.conf
, and set the [main] section as follows:[main] include=parent-profile
[main] include=parent-profile
Copy to Clipboard Copied! Replace parent-profile with the name of the profile you are modifying, for example:
throughput-performance
Include your profile modifications. For example, to lower swappiness in the
throughput-performance
profile, change the value ofvm.swappiness
to5
, instead of the default10
, use:[main] include=throughput-performance [sysctl] vm.swappiness=5
[main] include=throughput-performance [sysctl] vm.swappiness=5
Copy to Clipboard Copied! Activate the profile.
tuned-adm profile modified-profile
# tuned-adm profile modified-profile
Copy to Clipboard Copied!
Verification
View the profile is active and applied:
tuned-adm active tuned-adm verify
$ tuned-adm active Current active profile: modified-profile $ tuned-adm verify Verification succeeded, current system settings match the preset profile. See tuned log file ('/var/log/tuned/tuned.log') for details.
Copy to Clipboard Copied!
2.10. Enabling TuneD no-daemon mode
TuneD can be run in no-daemon mode, which does not require any resident memory. In this mode, TuneD applies the settings and then exits. However, note that this mode disables certain features, including D-Bus support, hot plug support, and rollback functionality for settings.
Prerequisites
- You have root privileges or appropriate permissions to modify the system configuration.
Procedure
Edit the
/etc/tuned/tuned-main.conf
file with the following changes:sudo vi /etc/tuned/tuned-main.conf Add the following line to the configuration file. daemon = 0
sudo vi /etc/tuned/tuned-main.conf Add the following line to the configuration file. daemon = 0
Copy to Clipboard Copied! - Save and close the file.
Restart the tuned service or reapply or switch profile:
systemctl restart tuned tuned-adm profile <tuned_profile>
# systemctl restart tuned # tuned-adm profile <tuned_profile>
Copy to Clipboard Copied! Verify the tuned status:
tuned-adm active
# tuned-adm active It seems that tuned daemon is not running, preset profile is not activated. Preset profile: <tuned_profile>
Copy to Clipboard Copied!