Chapter 1. Getting started with TuneD As a system administrator, you can use the TuneD application to optimize the performance profile of your system for a variety of use cases. 1.1. The purpose of TuneD TuneD is a service that monitors your system and optimizes the performance under certain workloads. The core of TuneD are profiles , which tune your system for different use cases. TuneD is distributed with a number of predefined profiles for use cases such as: High throughput Low latency Saving power It is possible to modify the rules defined for each profile and customize how to tune a particular device. When you switch to another profile or deactivate TuneD , all changes made to the system settings by the profile revert back to their original state. You can also configure TuneD to react to changes in device usage and adjusts settings to improve performance of active devices and reduce power consumption of inactive devices. 1.2. TuneD profiles A detailed analysis of a system can be very time-consuming. TuneD provides a number of predefined profiles for typical use cases. You can also create, modify, and delete profiles. The profiles provided with TuneD are divided into the following categories: Power-saving profiles Performance-boosting profiles The performance-boosting profiles include profiles that focus on the following aspects: Low latency for storage and network High throughput for storage and network Virtual machine performance Virtualization host performance Syntax of profile configuration The tuned.conf file can contain one [main] section and other sections for configuring plug-in instances. However, all sections are optional. Lines starting with the hash sign ( # ) are comments. Additional resources tuned.conf(5) man page on your system 1.3. The default TuneD profile During the installation, the best profile for your system is selected automatically. Currently, the default profile is selected according to the following customizable rules: Environment Default profile Goal Compute nodes throughput-performance The best throughput performance Virtual machines virtual-guest The best performance. If you are not interested in the best performance, you can change it to the balanced or powersave profile. Other cases balanced Balanced performance and power consumption Additional resources tuned.conf(5) man page on your system 1.4. Merged TuneD profiles As an experimental feature, it is possible to select more profiles at once. TuneD will try to merge them during the load. If there are conflicts, the settings from the last specified profile takes precedence. Example 1.1. Low power consumption in a virtual guest The following example optimizes the system to run in a virtual machine for the best performance and concurrently tunes it for low power consumption, while the low power consumption is the priority: Warning Merging is done automatically without checking whether the resulting combination of parameters makes sense. Consequently, the feature might tune some parameters the opposite way, which might be counterproductive: for example, setting the disk for high throughput by using the throughput-performance profile and concurrently setting the disk spindown to the low value by the spindown-disk profile. Additional resources tuned-adm and tuned.conf(5) man pages on your system 1.5. The location of TuneD profiles TuneD stores profiles in the following directories: /usr/lib/tuned/ Distribution-specific profiles are stored in the directory. Each profile has its own directory. The profile consists of the main configuration file called tuned.conf , and optionally other files, for example helper scripts. /etc/tuned/ If you need to customize a profile, copy the profile directory into the directory, which is used for custom profiles. If there are two profiles of the same name, the custom profile located in /etc/tuned/ is used. Additional resources tuned.conf(5) man page on your system 1.6. TuneD profiles distributed with RHEL The following is a list of profiles that are installed with TuneD on Red Hat Enterprise Linux. Note There might be more product-specific or third-party TuneD profiles available. Such profiles are usually provided by separate RPM packages. balanced The default power-saving profile. It is intended to be a compromise between performance and power consumption. It uses auto-scaling and auto-tuning whenever possible. The only drawback is the increased latency. In the current TuneD release, it enables the CPU, disk, audio, and video plugins, and activates the conservative CPU governor. The radeon_powersave option uses the dpm-balanced value if it is supported, otherwise it is set to auto . It changes the energy_performance_preference attribute to the normal energy setting. It also changes the scaling_governor policy attribute to either the conservative or powersave CPU governor. powersave A profile for maximum power saving performance. It can throttle the performance in order to minimize the actual power consumption. In the current TuneD release it enables USB autosuspend, WiFi power saving, and Aggressive Link Power Management (ALPM) power savings for SATA host adapters. It 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. On ASUS Eee PCs, a dynamic Super Hybrid Engine is enabled. It changes the energy_performance_preference attribute to the powersave or power energy setting. It also changes the scaling_governor policy attribute to either the ondemand or powersave CPU governor. Note In certain cases, the balanced profile is more efficient compared to the powersave profile. Consider there is a defined amount of work that needs to be done, for example a video file that needs to be transcoded. Your machine might consume less energy if the transcoding is done on the full power, because the task is finished quickly, the machine starts to idle, and it can automatically step-down to very efficient power save modes. On the other hand, if you transcode the file with a throttled machine, the machine consumes less power during the transcoding, but the process takes longer and the overall consumed energy can be higher. That is why the balanced profile can be generally a better option. throughput-performance A server profile optimized for high throughput. It disables power savings mechanisms and enables sysctl settings that improve the throughput performance of the disk and network IO. CPU governor is set to performance . It changes the energy_performance_preference and scaling_governor attribute to the performance profile. accelerator-performance The accelerator-performance profile 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. It 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). It changes the energy_performance_preference and scaling_governor attribute to the performance profile. 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. It inherits the latency-performance profile which changes the energy_performance_preference and scaling_governor attribute to the performance profile. 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. It inherits either the latency-performance or throughput-performance profile, and changes the energy_performance_preference and scaling_governor attribute to the performance profile. virtual-guest A profile designed for Red Hat Enterprise Linux 9 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. It inherits the throughput-performance profile and changes the energy_performance_preference and scaling_governor attribute to the performance profile. 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. It inherits the throughput-performance profile and changes the energy_performance_preference and scaling_governor attribute to the performance profile. oracle A profile optimized for Oracle databases loads based on 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: 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: 1.7. TuneD cpu-partitioning profile For tuning Red Hat Enterprise Linux 9 for latency-sensitive workloads, Red Hat recommends to use the cpu-partitioning TuneD profile. Prior to Red Hat Enterprise Linux 9, the low-latency Red Hat documentation described the numerous low-level steps needed to achieve low-latency tuning. In Red Hat Enterprise Linux 9, you can perform low-latency tuning more efficiently by using the cpu-partitioning TuneD profile. This profile is easily customizable according to the requirements for individual low-latency applications. The following figure is an example to demonstrate how to use the cpu-partitioning profile. This example uses the CPU and node layout. Figure 1.1. Figure cpu-partitioning You can configure the cpu-partitioning profile in the /etc/tuned/cpu-partitioning-variables.conf file using the following configuration options: Isolated CPUs with load balancing In the cpu-partitioning figure, the blocks numbered from 4 to 23, are the default isolated CPUs. The kernel scheduler's process load balancing is enabled on these CPUs. It is designed for low-latency processes with multiple threads that need the kernel scheduler load balancing. You can configure the cpu-partitioning profile in the /etc/tuned/cpu-partitioning-variables.conf file using the isolated_cores=cpu-list option, which lists CPUs to isolate that will use the kernel scheduler load balancing. The list of isolated CPUs is comma-separated or you can specify a range using a dash, such as 3-5 . This option is mandatory. Any CPU missing from this list is automatically considered a housekeeping CPU. Isolated CPUs without load balancing In the cpu-partitioning figure, the blocks numbered 2 and 3, are the isolated CPUs that do not provide any additional kernel scheduler process load balancing. You can configure the cpu-partitioning profile in the /etc/tuned/cpu-partitioning-variables.conf file using the no_balance_cores=cpu-list option, which lists CPUs to isolate that will not use the kernel scheduler load balancing. Specifying the no_balance_cores option is optional, however any CPUs in this list must be a subset of the CPUs listed in the isolated_cores list. Application threads using these CPUs need to be pinned individually to each CPU. Housekeeping CPUs Any CPU not isolated in the cpu-partitioning-variables.conf file is automatically considered a housekeeping CPU. On the housekeeping CPUs, all services, daemons, user processes, movable kernel threads, interrupt handlers, and kernel timers are permitted to execute. Additional resources tuned-profiles-cpu-partitioning(7) man page on your system 1.8. Using the TuneD cpu-partitioning profile for low-latency tuning This procedure describes how to tune a system for low-latency using the TuneD's cpu-partitioning profile. It uses the example of a low-latency application that can use cpu-partitioning and the CPU layout as mentioned in the cpu-partitioning figure. The application in this case uses: One dedicated reader thread that reads data from the network will be pinned to CPU 2. A large number of threads that process this network data will be pinned to CPUs 4-23. A dedicated writer thread that writes the processed data to the network will be pinned to CPU 3. Prerequisites You have installed the cpu-partitioning TuneD profile by using the dnf install tuned-profiles-cpu-partitioning command as root. Procedure Edit the /etc/tuned/cpu-partitioning-variables.conf file with the following changes: Comment the isolated_cores=USD{f:calc_isolated_cores:1} line: Add the following information for isolated CPUS: Set the cpu-partitioning TuneD profile: Reboot the system. After rebooting, the system is tuned for low-latency, according to the isolation in the cpu-partitioning figure. The application can use taskset to pin the reader and writer threads to CPUs 2 and 3, and the remaining application threads on CPUs 4-23. Verification Verify that the isolated CPUs are not reflected in the Cpus_allowed_list field: To see affinity of all processes, enter: Note TuneD cannot change the affinity of some processes, mostly kernel processes. In this example, processes with PID 4 and 9 remain unchanged. Additional resources tuned-profiles-cpu-partitioning(7) man page 1.9. Customizing the cpu-partitioning TuneD profile You can extend the TuneD profile to make additional tuning changes. For example, the cpu-partitioning profile sets the CPUs to use cstate=1 . In order to use the cpu-partitioning profile but to additionally change the CPU cstate from cstate1 to cstate0, the following procedure describes a new TuneD profile named my_profile , which inherits the cpu-partitioning profile and then sets C state-0. Procedure Create the /etc/tuned/my_profile directory: Create a tuned.conf file in this directory, and add the following content: Use the new profile: Note In the shared example, a reboot is not required. However, if the changes in the my_profile profile require a reboot to take effect, then reboot your machine. Additional resources tuned-profiles-cpu-partitioning(7) man page on your system 1.10. Real-time TuneD profiles distributed with RHEL Real-time profiles are intended 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 from additional repositories. The following real-time profiles are available: realtime Use on bare-metal real-time systems. 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. 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. Provided by the tuned-profiles-nfv-guest package, which is available from the NFV repository. 1.11. Static and dynamic tuning in TuneD Understanding the difference between the two categories of system tuning that TuneD applies, static and dynamic , is important when determining which one to use for a given situation or purpose. Static tuning Mainly consists of the application of predefined sysctl and sysfs settings and one-shot activation of several configuration tools such as ethtool . Dynamic tuning Watches how various system components are used throughout the uptime of your system. TuneD adjusts system settings dynamically based on that monitoring information. For example, the hard drive is used heavily during startup and login, but is barely used later when the user might mainly work with applications such as web browsers or email clients. Similarly, the CPU and network devices are used differently at different times. TuneD monitors the activity of these components and reacts to the changes in their use. By default, dynamic tuning is disabled. To enable it, edit the /etc/tuned/tuned-main.conf file and change the dynamic_tuning option to 1 . TuneD then periodically analyzes system statistics and uses them to update your system tuning settings. To configure the time interval in seconds between these updates, use the update_interval option. Currently implemented dynamic tuning algorithms try to balance the performance and powersave, and are therefore disabled in the performance profiles. Dynamic tuning for individual plug-ins can be enabled or disabled in the TuneD profiles. Example 1.2. Static and dynamic tuning on a workstation On a typical office workstation, the Ethernet network interface is inactive most of the time. Only a few emails go in and out or some web pages might be loaded. For those kinds of loads, the network interface does not have to run at full speed all the time, as it does by default. TuneD has a monitoring and tuning plug-in for network devices that can detect this low activity and then automatically lower the speed of that interface, typically resulting in a lower power usage. If the activity on the interface increases for a longer period of time, for example because a DVD image is being downloaded or an email with a large attachment is opened, TuneD detects this and sets the interface speed to maximum to offer the best performance while the activity level is high. This principle is used for other plug-ins for CPU and disks as well. 1.12. TuneD no-daemon mode You can run TuneD in no-daemon mode, which does not require any resident memory. In this mode, TuneD applies the settings and exits. By default, no-daemon mode is disabled because a lot of TuneD functionality is missing in this mode, including: D-Bus support Hot-plug support Rollback support for settings To enable no-daemon mode, include the following line in the /etc/tuned/tuned-main.conf file: 1.13. Installing and enabling TuneD This procedure installs and enables the TuneD application, installs TuneD profiles, and presets a default TuneD profile for your system. Procedure Install the TuneD package: Enable and start the TuneD service: Optional: Install TuneD profiles for real-time systems: For the TuneD profiles for real-time systems enable rhel-9 repository. Install it. Verify that a TuneD profile is active and applied: Note The active profile TuneD automatically presets differs based on your machine type and system settings. 1.14. Listing available TuneD profiles This procedure lists all TuneD profiles that are currently available on your system. Procedure To list all available TuneD profiles on your system, use: USD tuned-adm list Available profiles: - accelerator-performance - Throughput performance based tuning with disabled higher latency STOP states - 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: balanced To display only the currently active profile, use: Additional resources tuned-adm(8) man page on your system 1.15. Setting a TuneD profile This procedure activates a selected TuneD profile on your system. Prerequisites The TuneD service is running. See Installing and Enabling TuneD for details. Procedure Optional: You can let TuneD recommend the most suitable profile for your system: Activate a profile: Alternatively, you can activate a combination of multiple profiles: Example 1.3. A virtual machine optimized for low power consumption The following example optimizes the system to run in a virtual machine with the best performance and concurrently tunes it for low power consumption, while the low power consumption is the priority: View the current active TuneD profile on your system: Reboot the system: Verification Verify that the TuneD profile is active and applied: Additional resources tuned-adm(8) man page on your system 1.16. Using the TuneD D-Bus interface You can directly communicate with TuneD at runtime through the TuneD D-Bus interface to control a variety of TuneD services. You can use the busctl or dbus-send commands to access the D-Bus API. Note Although you can use either the busctl or dbus-send command, the busctl command is a part of systemd and, therefore, present on most hosts already. 1.16.1. Using the TuneD D-Bus interface to show available TuneD D-Bus API methods You can see the D-Bus API methods available to use with TuneD by using the TuneD D-Bus interface. Prerequisites The TuneD service is running. See Installing and Enabling TuneD for details. Procedure To see the available TuneD API methods, run: The output should look similar to the following: You can find descriptions of the different available methods in the TuneD upstream repository . 1.16.2. Using the TuneD D-Bus interface to change the active TuneD profile You can replace the active TuneD profile with your desired TuneD profile by using the TuneD D-Bus interface. Prerequisites The TuneD service is running. See Installing and Enabling TuneD for details. Procedure To change the active TuneD profile, run: Replace profile with the name of your desired profile. Verification To view the current active TuneD profile, run: 1.17. Disabling TuneD This procedure disables TuneD and resets all affected system settings to their original state before TuneD modified them. Procedure To disable all tunings temporarily: The tunings are applied again after the TuneD service restarts. Alternatively, to stop and disable the TuneD service permanently: Additional resources tuned-adm(8) man page on your system

Commands:
tuned-adm profile virtual-guest powersave
tuned-adm profile throughput-performance optimize-serial-console
tuned-adm profile cpu-partitioning intel-sst
isolated_cores=USD{f:calc_isolated_cores:1}
All isolated CPUs: isolated_cores=2-23 Isolated CPUs without the kernel's scheduler load balancing: no_balance_cores=2,3
tuned-adm profile cpu-partitioning
cat /proc/self/status | grep Cpu Cpus_allowed: 003 Cpus_allowed_list: 0-1
ps -ae -o pid= | xargs -n 1 taskset -cp pid 1's current affinity list: 0,1 pid 2's current affinity list: 0,1 pid 3's current affinity list: 0,1 pid 4's current affinity list: 0-5 pid 5's current affinity list: 0,1 pid 6's current affinity list: 0,1 pid 7's current affinity list: 0,1 pid 9's current affinity list: 0
mkdir /etc/tuned/ my_profile
vi /etc/tuned/ my_profile /tuned.conf [main] summary=Customized tuning on top of cpu-partitioning include=cpu-partitioning [cpu] force_latency=cstate.id:0|1
tuned-adm profile my_profile
daemon = 0
dnf install tuned
systemctl enable --now tuned
subscription-manager repos --enable=rhel-9-for-x86_64-nfv-beta-rpms
dnf install tuned-profiles-realtime tuned-profiles-nfv
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.
tuned-adm list Available profiles: - accelerator-performance - Throughput performance based tuning with disabled higher latency STOP states - 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: balanced
tuned-adm active Current active profile: throughput-performance
tuned-adm recommend throughput-performance
tuned-adm profile selected-profile
tuned-adm profile selected-profile1 selected-profile2
tuned-adm profile virtual-guest powersave
tuned-adm active Current active profile: selected-profile
reboot
tuned-adm verify Verification succeeded, current system settings match the preset profile. See tuned log file ('/var/log/tuned/tuned.log') for details.
busctl introspect com.redhat.tuned /Tuned com.redhat.tuned.control
NAME TYPE SIGNATURE RESULT/VALUE FLAGS .active_profile method - s - .auto_profile method - (bs) - .disable method - b - .get_all_plugins method - a{sa{ss}} - .get_plugin_documentation method s s - .get_plugin_hints method s a{ss} - .instance_acquire_devices method ss (bs) - .is_running method - b - .log_capture_finish method s s - .log_capture_start method ii s - .post_loaded_profile method - s - .profile_info method s (bsss) - .profile_mode method - (ss) - .profiles method - as - .profiles2 method - a(ss) - .recommend_profile method - s - .register_socket_signal_path method s b - .reload method - b - .start method - b - .stop method - b - .switch_profile method s (bs) - .verify_profile method - b - .verify_profile_ignore_missing method - b - .profile_changed signal sbs - -
busctl call com.redhat.tuned /Tuned com.redhat.tuned.control switch_profile s profile (bs) true "OK"
busctl call com.redhat.tuned /Tuned com.redhat.tuned.control active_profile s " profile "
tuned-adm off
systemctl disable --now tuned