Performance tuning with tuned and tuned-adm in Redhat and CentOS

The tuned is a dynamic adaptive system tuning daemon running on Redhat or CentOS. It can adapt the operating system to perform better under certain workloads by setting a tuning profile.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@vm1 ~]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

[root@vm1 ~]# systemctl status tuned
● tuned.service - Dynamic System Tuning Daemon
Loaded: loaded (/usr/lib/systemd/system/tuned.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2024-02-23 22:05:27 UTC; 2h 25min ago
Docs: man:tuned(8)
man:tuned.conf(5)
man:tuned-adm(8)
Main PID: 2719 (tuned)
Tasks: 5
Memory: 28.5M
CGroup: /system.slice/tuned.service
└─2719 /usr/bin/python2 -Es /usr/sbin/tuned -l -P

Feb 23 22:05:26 vm1 systemd[1]: Starting Dynamic System Tuning Daemon...
Feb 23 22:05:27 vm1 systemd[1]: Started Dynamic System Tuning Daemon.

The tuned-adm command-line tool allows users to switch between different tuning profiles.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
[root@vm1 ~]# tuned-adm -h
usage: tuned-adm [-h] [--version] [--debug] [--async] [--timeout TIMEOUT]
[--loglevel LOGLEVEL]

{list,active,off,profile,profile_info,recommend,verify,auto_profile,profile_mode}
...

Manage tuned daemon.

positional arguments:
{list,active,off,profile,profile_info,recommend,verify,auto_profile,profile_mode}
list list available profiles or plugins (by default
profiles)
active show active profile
off switch off all tunings
profile switch to a given profile, or list available profiles
if no profile is given
profile_info show information/description of given profile or
current profile if no profile is specified
recommend recommend profile
verify verify profile
auto_profile enable automatic profile selection mode, switch to the
recommended profile
profile_mode show current profile selection mode

optional arguments:
-h, --help show this help message and exit
--version, -v show program's version number and exit
--debug, -d show debug messages
--async, -a with dbus do not wait on commands completion and
return immediately
--timeout TIMEOUT, -t TIMEOUT
with sync operation use specific timeout instead of
the default 600 second(s)
--loglevel LOGLEVEL, -l LOGLEVEL
level of log messages to capture (one of info, none,
console, warn, error, debug). Default: console

To list the available tuning profiles:

1
2
3
4
5
6
7
8
9
10
11
12
13
[root@vm1 ~]# tuned-adm list
Available profiles:
- balanced - General non-specialized tuned profile
- desktop - Optimize for the desktop use-case
- hpc-compute - Optimize for HPC compute workloads
- 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 check the current active tuning profile:

1
2
[root@vm1 ~]# tuned-adm active
Current active profile: balanced

The configuration for each tuning profile can be found in the tuned.conf file under directory /usr/lib/tuned/[tuning profile]/.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
[root@vm1 ~]# ls -la /usr/lib/tuned/
total 68
drwxr-xr-x. 13 root root 4096 Apr 4 2022 .
dr-xr-xr-x. 35 root root 4096 Apr 4 2022 ..
drwxr-xr-x. 2 root root 4096 Apr 4 2022 balanced
drwxr-xr-x. 2 root root 4096 Apr 4 2022 desktop
-rw-r--r--. 1 root root 14687 Oct 1 2020 functions
drwxr-xr-x. 2 root root 4096 Apr 4 2022 hpc-compute
drwxr-xr-x. 2 root root 4096 Apr 4 2022 latency-performance
drwxr-xr-x. 2 root root 4096 Apr 4 2022 network-latency
drwxr-xr-x. 2 root root 4096 Apr 4 2022 network-throughput
drwxr-xr-x. 2 root root 4096 Apr 4 2022 powersave
drwxr-xr-x. 2 root root 4096 Apr 4 2022 recommend.d
drwxr-xr-x. 2 root root 4096 Apr 4 2022 throughput-performance
drwxr-xr-x. 2 root root 4096 Apr 4 2022 virtual-guest
drwxr-xr-x. 2 root root 4096 Apr 4 2022 virtual-host

To examine the tuning parameters for the tuning profile:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[root@vm1 ~]# cat /usr/lib/tuned/balanced/tuned.conf
#
# tuned configuration
#

[main]
summary=General non-specialized tuned profile

[modules]
cpufreq_conservative=+r

[cpu]
priority=10
governor=conservative|powersave
energy_perf_bias=normal

[audio]
timeout=10

[video]
radeon_powersave=dpm-balanced, auto

[disk]
# Comma separated list of devices, all devices if commented out.
# devices=sda

[scsi_host]
alpm=medium_power

To activate a tuning profile,

1
[root@vm1 ~]# tuned-adm profile [new_profile]

You can also create your own custom profile by simply copying the existing profile and modifying the parameters accordingly.

1
2
[root@vm1 ~]# cp -r /usr/lib/tuned/throughput-performance /usr/lib/tuned/my-throughput-performance
[root@vm1 ~]# vim /usr/lib/tuned/my-throughput-performance/tuned.conf