Este contenido no está disponible en el idioma seleccionado.
Chapter 2. 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.
2.1. The purpose of TuneD Copiar enlaceEnlace copiado en el portapapeles!
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 previous 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.
2.2. TuneD profiles Copiar enlaceEnlace copiado en el portapapeles!
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.
2.3. The default TuneD profile Copiar enlaceEnlace copiado en el portapapeles!
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 |
| The best throughput performance |
| Virtual machines |
|
The best performance. If you are not interested in the best performance, you can change it to the |
| Other cases |
| Balanced performance and power consumption |
2.4. Merged TuneD profiles Copiar enlaceEnlace copiado en el portapapeles!
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 2.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:
tuned-adm profile virtual-guest powersave
# tuned-adm profile virtual-guest powersave
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.
2.5. The location of TuneD profiles Copiar enlaceEnlace copiado en el portapapeles!
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.
2.6. TuneD profiles distributed with RHEL Copiar enlaceEnlace copiado en el portapapeles!
The following is a list of profiles that are installed with TuneD on Red Hat Enterprise Linux.
There might be more product-specific or third-party TuneD profiles available. Such profiles are usually provided by separate RPM packages.
balancedThe 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
conservativeCPU governor. Theradeon_powersaveoption uses thedpm-balancedvalue if it is supported, otherwise it is set toauto.It changes the
energy_performance_preferenceattribute to thenormalenergy setting. It also changes thescaling_governorpolicy attribute to either theconservativeorpowersaveCPU governor.powersaveA 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
ondemandgovernor. 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_preferenceattribute to thepowersaveorpowerenergy setting. It also changes thescaling_governorpolicy attribute to either theondemandorpowersaveCPU governor.NoteIn certain cases, the
balancedprofile is more efficient compared to thepowersaveprofile.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
balancedprofile can be generally a better option.throughput-performanceA server profile optimized for high throughput. It disables power savings mechanisms and enables
sysctlsettings that improve the throughput performance of the disk and network IO. CPU governor is set toperformance.It changes the
energy_performance_preferenceandscaling_governorattribute to theperformanceprofile.accelerator-performance-
The
accelerator-performanceprofile contains the same tuning as thethroughput-performanceprofile. 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-performanceA server profile optimized for low latency. It disables power savings mechanisms and enables
sysctlsettings that improve latency. CPU governor is set toperformanceand the CPU is locked to the low C states (by PM QoS).It changes the
energy_performance_preferenceandscaling_governorattribute to theperformanceprofile.network-latencyA profile for low latency network tuning. It is based on the
latency-performanceprofile. It additionally disables transparent huge pages and NUMA balancing, and tunes several other network-relatedsysctlparameters.It inherits the
latency-performanceprofile which changes theenergy_performance_preferenceandscaling_governorattribute to theperformanceprofile.hpc-compute-
A profile optimized for high-performance computing. It is based on the
latency-performanceprofile. network-throughputA profile for throughput network tuning. It is based on the
throughput-performanceprofile. It additionally increases kernel network buffers.It inherits either the
latency-performanceorthroughput-performanceprofile, and changes theenergy_performance_preferenceandscaling_governorattribute to theperformanceprofile.virtual-guestA profile designed for Red Hat Enterprise Linux 9 virtual machines and VMWare guests based on the
throughput-performanceprofile that, among other tasks, decreases virtual memory swappiness and increases disk readahead values. It does not disable disk barriers.It inherits the
throughput-performanceprofile and changes theenergy_performance_preferenceandscaling_governorattribute to theperformanceprofile.virtual-hostA profile designed for virtual hosts based on the
throughput-performanceprofile 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-performanceprofile and changes theenergy_performance_preferenceandscaling_governorattribute to theperformanceprofile.oracle-
A profile optimized for Oracle databases loads based on
throughput-performanceprofile. It additionally disables transparent huge pages and modifies other performance-related kernel parameters. This profile is provided by thetuned-profiles-oraclepackage. desktop-
A profile optimized for desktops, based on the
balancedprofile. It additionally enables scheduler autogroups for better response of interactive applications. optimize-serial-consoleA 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-consoleCopy to Clipboard Copied! Toggle word wrap Toggle overflow mssql-
A profile provided for Microsoft SQL Server. It is based on the
throughput-performanceprofile. intel-sstA 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-sstCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.7. TuneD cpu-partitioning profile Copiar enlaceEnlace copiado en el portapapeles!
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 2.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.conffile using theisolated_cores=cpu-listoption, 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.conffile using theno_balance_cores=cpu-listoption, which lists CPUs to isolate that will not use the kernel scheduler load balancing.Specifying the
no_balance_coresoption is optional, however any CPUs in this list must be a subset of the CPUs listed in theisolated_coreslist.Application threads using these CPUs need to be pinned individually to each CPU.
- Housekeeping CPUs
-
Any CPU not isolated in the
cpu-partitioning-variables.conffile 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.
2.8. Using the TuneD cpu-partitioning profile for low-latency tuning Copiar enlaceEnlace copiado en el portapapeles!
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-partitioningTuneD profile by using thednf install tuned-profiles-cpu-partitioningcommand as root.
Procedure
Edit the
/etc/tuned/cpu-partitioning-variables.conffile with the following changes:Comment the
isolated_cores=${f:calc_isolated_cores:1}line:isolated_cores=${f:calc_isolated_cores:1}# isolated_cores=${f:calc_isolated_cores:1}Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the following information for isolated CPUS:
All isolated CPUs: Isolated CPUs without the kernel’s scheduler load balancing:
# All isolated CPUs: isolated_cores=2-23 # Isolated CPUs without the kernel’s scheduler load balancing: no_balance_cores=2,3Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Set the
cpu-partitioningTuneD profile:tuned-adm profile cpu-partitioning
# tuned-adm profile cpu-partitioningCopy to Clipboard Copied! Toggle word wrap Toggle overflow 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_listfield:cat /proc/self/status | grep Cpu Cpus_allowed: 003 Cpus_allowed_list: 0-1
# cat /proc/self/status | grep Cpu Cpus_allowed: 003 Cpus_allowed_list: 0-1Copy to Clipboard Copied! Toggle word wrap Toggle overflow To see affinity of all processes, enter:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteTuneD cannot change the affinity of some processes, mostly kernel processes. In this example, processes with PID 4 and 9 remain unchanged.
2.9. Customizing the cpu-partitioning TuneD profile Copiar enlaceEnlace copiado en el portapapeles!
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_profiledirectory:mkdir /etc/tuned/my_profile
# mkdir /etc/tuned/my_profileCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a
tuned.conffile in this directory, and add the following content:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the new profile:
tuned-adm profile my_profile
# tuned-adm profile my_profileCopy to Clipboard Copied! Toggle word wrap Toggle overflow
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.
2.10. Real-time TuneD profiles distributed with RHEL Copiar enlaceEnlace copiado en el portapapeles!
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:
realtimeUse on bare-metal real-time systems.
Provided by the
tuned-profiles-realtimepackage, which is available from the RT or NFV repositories.realtime-virtual-hostUse in a virtualization host configured for real-time.
Provided by the
tuned-profiles-nfv-hostpackage, which is available from the NFV repository.realtime-virtual-guestUse in a virtualization guest configured for real-time.
Provided by the
tuned-profiles-nfv-guestpackage, which is available from the NFV repository.
2.11. Static and dynamic tuning in TuneD Copiar enlaceEnlace copiado en el portapapeles!
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
sysctlandsysfssettings and one-shot activation of several configuration tools such asethtool. - 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.conffile and change thedynamic_tuningoption to1. 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 theupdate_intervaloption.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 2.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.
2.12. TuneD no-daemon mode Copiar enlaceEnlace copiado en el portapapeles!
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:
daemon = 0
daemon = 0
2.13. Installing and enabling TuneD Copiar enlaceEnlace copiado en el portapapeles!
This procedure installs and enables the TuneD application, installs TuneD profiles, and presets a default TuneD profile for your system.
Procedure
Install the
TuneDpackage:dnf install tuned
# dnf install tunedCopy to Clipboard Copied! Toggle word wrap Toggle overflow Enable and start the
TuneDservice:systemctl enable --now tuned
# systemctl enable --now tunedCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Install TuneD profiles for real-time systems:
For the TuneD profiles for real-time systems enable
rhel-9repository.subscription-manager repos --enable=rhel-9-for-x86_64-nfv-beta-rpms
# subscription-manager repos --enable=rhel-9-for-x86_64-nfv-beta-rpmsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install it.
dnf install tuned-profiles-realtime tuned-profiles-nfv
# dnf install tuned-profiles-realtime tuned-profiles-nfvCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify that a TuneD profile is active and applied:
tuned-adm active
$ tuned-adm active Current active profile: throughput-performanceCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteThe active profile TuneD automatically presets differs based on your machine type and system settings.
tuned-adm verify
$ 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! Toggle word wrap Toggle overflow
2.14. Listing available TuneD profiles Copiar enlaceEnlace copiado en el portapapeles!
This procedure lists all TuneD profiles that are currently available on your system.
Procedure
To list all available TuneD profiles on your system, use:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To display only the currently active profile, use:
tuned-adm active
$ tuned-adm active Current active profile: throughput-performanceCopy to Clipboard Copied! Toggle word wrap Toggle overflow
2.15. Setting a TuneD profile Copiar enlaceEnlace copiado en el portapapeles!
This procedure activates a selected TuneD profile on your system.
Prerequisites
-
The
TuneDservice is running. See Installing and Enabling TuneD for details.
Procedure
Optional: You can let TuneD recommend the most suitable profile for your system:
tuned-adm recommend
# tuned-adm recommend throughput-performanceCopy to Clipboard Copied! Toggle word wrap Toggle overflow Activate a profile:
tuned-adm profile selected-profile
# tuned-adm profile selected-profileCopy to Clipboard Copied! Toggle word wrap Toggle overflow Alternatively, you can activate a combination of multiple profiles:
tuned-adm profile selected-profile1 selected-profile2
# tuned-adm profile selected-profile1 selected-profile2Copy to Clipboard Copied! Toggle word wrap Toggle overflow Example 2.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:
tuned-adm profile virtual-guest powersave
# tuned-adm profile virtual-guest powersaveCopy to Clipboard Copied! Toggle word wrap Toggle overflow View the current active TuneD profile on your system:
tuned-adm active
# tuned-adm active Current active profile: selected-profileCopy to Clipboard Copied! Toggle word wrap Toggle overflow Reboot the system:
reboot
# rebootCopy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Verify that the TuneD profile is active and applied:
tuned-adm verify
$ 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! Toggle word wrap Toggle overflow
2.16. Using the TuneD D-Bus interface Copiar enlaceEnlace copiado en el portapapeles!
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.
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.
2.16.1. Using the TuneD D-Bus interface to show available TuneD D-Bus API methods Copiar enlaceEnlace copiado en el portapapeles!
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:
busctl introspect com.redhat.tuned /Tuned com.redhat.tuned.control
$ busctl introspect com.redhat.tuned /Tuned com.redhat.tuned.controlCopy to Clipboard Copied! Toggle word wrap Toggle overflow The output should look similar to the following:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can find descriptions of the different available methods in the TuneD upstream repository.
2.16.2. Using the TuneD D-Bus interface to change the active TuneD profile Copiar enlaceEnlace copiado en el portapapeles!
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:
busctl call com.redhat.tuned /Tuned com.redhat.tuned.control switch_profile s profile
$ busctl call com.redhat.tuned /Tuned com.redhat.tuned.control switch_profile s profile (bs) true "OK"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace profile with the name of your desired profile.
Verification
To view the current active TuneD profile, run:
busctl call com.redhat.tuned /Tuned com.redhat.tuned.control active_profile
$ busctl call com.redhat.tuned /Tuned com.redhat.tuned.control active_profile s "profile"Copy to Clipboard Copied! Toggle word wrap Toggle overflow
2.17. Disabling TuneD Copiar enlaceEnlace copiado en el portapapeles!
This procedure disables TuneD and resets all affected system settings to their original state before TuneD modified them.
Procedure
To disable all tunings temporarily:
tuned-adm off
# tuned-adm offCopy to Clipboard Copied! Toggle word wrap Toggle overflow The tunings are applied again after the
TuneDservice restarts.Alternatively, to stop and disable the
TuneDservice permanently:systemctl disable --now tuned
# systemctl disable --now tunedCopy to Clipboard Copied! Toggle word wrap Toggle overflow