4 Working With TuneD

The TuneD utility is a tool for monitoring a system so you can optimize its performance under certain conditions. The utility consists of the following main components:

  • TuneD profiles
  • The tune-adm command

The basic TuneD feature is provided by the tuned package. Depending on where Oracle Linux is running, this package might be automatically installed with the OS, such as on an Oracle Linux instance on Oracle Cloud Infrastructure.

To verify whether TuneD is already in the system, type:

dnf list tuned
Installed Packages
tuned.noarch     version
...

If the feature isn't in the system, do the following:

  1. Install the tuned package.

    sudo dnf install tuned
  2. Enable the tuned service.

    sudo systemctl enable --now tuned

To list other TuneD packages that are available but not installed in the system, type:

sudo dnf list tuned-profiles*

If you require other TuneD packages, you would also need to install these afterward.

About TuneD Profiles

TuneD performs system optimization by working with TuneD profiles. TuneD profiles consist of predefined sets of optimization rules that apply tuning tasks under different use cases.

After the appropriate package is installed, you can list the available profiles with the following command:

tuned-adm list

The output of this command depends on where Oracle Linux is running. On physical and virtual systems, the available profiles might resemble the following:

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
- hpc-compute                 - Optimize for HPC compute workloads
...

On an Oracle Linux instance that's running in Oracle Cloud Infrastructure, the list would include extra profiles:

...
- oci-busy-polling            - Enable Busy Polling conditionally in OCI
- oci-cpu-power               - Set processor power management parameters in OCI
- oci-nic                     - Increase combined channels to 16 on NICs with bnxt_en driver on BM shapes in OCI
- oci-rps-xps                 - Enable RPS/XPS conditionally in OCI
...

The following are selected profiles that TuneD uses to optimize the system. The list isn't exhaustive.

  • balanced: Provides a balance between performance and power consumption. The profile uses automatic scaling and automatic tuning when possible. A possible drawback is increased latency.

  • powersave: Provides maximum power saving performance. The profile can minimize actual power consumption by throttling performance.

    Note:

    In some instances, the balanced profile is more efficient than the powersave profile and therefore, a better choice.

  • throughput-performance: Disables power-savings mechanisms and enables sysctl settings to improve the throughput performance of the disk and network IO.

  • latency-performance: Optimized for low latency by disabling power-savings mechanisms and enabling sysctl settings to improve latency.

  • network-latency: Provides low latency network tuning and is based on the latency-performance profile. In addition, this profile disables transparent huge pages and NUMA balancing and tunes several network-related sysctl settings.

  • network-throughput: Used for optimizing throughput network tuning, based on the throughput-performance profile. In addition, this profile increases kernel network buffers.

  • virtual-guest: Designed for virtual guests and is based on the throughput-performance profile. This profile decreases virtual memory swappiness values and increases disk readahead values.

  • virtual-host: Designed for virtual hosts and is based on the throughput-performance profile. This profile decreases virtual memory swappiness values, increases disk readahead values, and sets a more aggressive value for dirty pages writeback.

  • desktop: Optimized for desktop environments and is based on the balanced profile. In addition, this profile sets scheduler autogroups for better response of interactive applications.

About Configuration Files for TuneD Profiles

Profiles are automatically stored in the following locations:

  • /usr/lib/tuned contains the predefined profiles.
  • /etc/tuned contains custom profiles in addition to other files that are installed by default.

TuneD profiles direct how optimization is performed on the system's resources and components. The profiles are predefined and fall under one of two general categories: power-saving profiles and performance-boosting profiles.

For example, the /usr/lib/tuned/desktop profile optimizes desktop-related resources, while /usr/lib/tuned/powersave optimizes the system's power consumption.

Profiles operate by using optimization rules that have been set for the profiles. Each profile's rules are contained in a corresponding tuned.conf file. Thus, for the desktop profile, the rules are defined in /usr/lib/tuned/desktop/tuned.conf, while the rules for the powersave profile are defined in /usr/lib/tuned/powersave/tuned.conf.

As an example, the following shows the contents of the configuration file for the desktop profile:

less /usr/lib/tuned/desktop/tuned.conf
#
# tuned configuration
#

[main]
summary=Optimize for the desktop use-case
include=balanced

[sysctl]
kernel.sched_autogroup_enabled=1

In these configuration files, you can change the rules for that profile or customize how profiles optimize specific devices. In addition, you can configure TuneD so that any changes in device usage triggers a change in the current settings. By adjusting the configuration file definitions, you can customize and improve optimization in specific systems.

To create a custom profile, copy the /usr/lib/tuned/profile directory to the /etc/tuned directory. Then change the profile's tuned.conf.

For more information about profile configuration, see the tuned.conf(5) manual page.

Using the tuned-adm Command

To avail of the features in the TuneD utility, use the tuned-adm command. The following tasks describe how to administer TuneD profiles and the tuned service in Oracle Linux.

For more information, see the tuned-adm(8) and tuned(8) manual pages.

Listing Available and Active Profiles in the System

To list the profiles in the system, type:

sudo tuned-adm list

The number of profiles that's displayed depends on whether you're using an Oracle Linux system or an Oracle Linux instance in Oracle Cloud Infrastructure.

The output always ends by displaying the profile that's in use. On an Oracle Linux instance in Oracle Cloud Infrastructure, for example, the final line would be similar to the following:

...
Current active profile: oci-rps-xps oci-busy-polling oci-cpu-power oci-nic

On a physical system or a virtual machine, the default active profile might be different.

To directly query which profile is active in the system or instance without listing all available profiles, type:

sudo tuned-adm active

Verifying That the System is Optimized According to the Profile

You might want to verify that the system has been optimized to match the settings as defined in the active profile. Follow these steps:

  1. Run the verify subcommand.
    sudo tuned-adm verify
    Verfication succeeded, current system settings match the preset profile.
    See TuneD log file ('/var/log/tuned/tuned.log') for details.
  2. Optionally, examine the contents of the TuneD log for more detailed information.
    less /var/log/tuned/tuned.log

Querying for a Recommended Profile

If the recommend parameter is enabled in /etc/tuned/tuned-main.conf, TuneD can suggest an optimization profile that's more suitable, for example:

sudo tuned-adm recommend
balanced

Selecting and Activating Profiles

When tuned is enabled on a system or instance, a default TuneD profile becomes automatically active. However, you can select a different profile and activate it so that system optimization is performed based on that profile. Use the following syntax:

sudo tuned-adm profile profile1 [profile2 profile3 ...]

The following is a suggested method of changing an active profile:

  1. Check the current active profile.
    sudo tuned-adm active
    balanced
  2. Optionally, list the available profiles in the system.
    sudo tuned-adm list
  3. Select a different profile to activate.
    sudo tuned-adm profile powersave
  4. Verify the change.
    sudo tuned-adm active
    powersave

Caution:

TuneD might activate several profiles. Where profile rules conflict, TuneD applies the settings of the last profile that you specified in the command.

When profiles are merged, TuneD can't decide whether the combination is logical or not. So parameters in those profiles that are related to the performance of a common component or resource risk being tuned in opposite ways. Merging profiles doesn't always guarantee that better optimization is obtained.

Oracle Linux instances on Oracle Cloud Infrastructure are an exception, where several oci-* profiles are automatically activated when TuneD is installed.

Disabling TuneD

To disable TuneD temporarily, switch the TuneD service off. Switching the service off removes active profiles and effectively stops all tuning operations in the system. To resume tuning, activate a profile. The following steps illustrate how to halt system tuning.

  1. Optionally, note down the current active profile.
    sudo tuned-adm active
  2. Switch TuneD off.
    sudo tuned-adm off
  3. Verify the status of system tuning.
    sudo tuned-adm active
    No current active profile.

To resume system tuning, do the following:

  1. Decide which profile to reactivate.
    • To identify and then use the default profile that has been predefined for the current system environment or instance, type:
      sudo tuned-adm recommend
    • To select a profile other than the default profile, display the available profiles. Type:
      sudo tuned-adm list
    • To reuse the same profile that was active before TuneD was switched off, consult notes you have taken based on the previous steps to switch off the TuneD service.
  2. Activate the selected profile.
    sudo tuned-adm profile profile

To disable system tuning permanently, stop the tuned service.

sudo systemctl disable --now tuned

Applying Global Settings to the TuneD Utility

The /etc/tuned/tuned-main.conf regulates the entire tuned service through defined global settings. The following is an extract of the file:

# Global tuned configuration file.

# Whether to use daemon. Without daemon it just applies tuning. It is
# not recommended, because many functions don't work without daemon,
# e.g. there will be no D-Bus, no rollback of settings, no hotplug,
# no dynamic tuning, ...
daemon = 1

# Dynamicaly tune devices, if disabled only static tuning will be used.
dynamic_tuning = 0

# How long to sleep before checking for events (in seconds)
# higher number means lower overhead but longer response time.
sleep_interval = 1

# Update interval for dynamic tunings (in seconds).
# It must be multiply of the sleep_interval.
update_interval = 10

# Recommend functionality, if disabled "recommend" command will be not
# available in CLI, daemon will not parse recommend.conf but will return
# one hardcoded profile (by default "balanced").
recommend_command = 1
...

The following are sample cases for which you can configure parameters in /etc/tuned/tuned-main.conf:

  • Selecting between static or dynamic

    With the dynamic_tuning parameter, you can choose whether system tuning is static or dynamic.

    By default, static tuning is operative in the system. Static tuning applies settings that have been predefined for sysctl and sysfs commands, or those that are set for configuration tools at the moment these tools are activated. Thereafter, no more tuning is performed.

    Dynamic tuning instead is performed continuously. TuneD monitors the system at intervals throughout the system's up time. Based on the information gathered at a specific interval, TuneD optimizes the system. The interval at which TuneD monitors and optimizes components is configured by the value of the uptime_interval, which by default is set to 10 seconds.

  • Selecting between daemon or no-daemon mode

    With the daemon parameter, you can set the mode for system tuning.

    By default, the functionalities of TuneD are active if the daemon is running. If TuneD is switched to run with the daemon disabled, then TuneD applies the profile settings and then exits. This mode isn't recommended because some TuneD functionalities, such as compatibility with DBus, hotplugging, and rollback of settings, are absent if the daemon is disabled.