As a System administrator, you should be able to optimize the performance of a Linux system to suit your use case workloads by adjusting various settings. This guide has been written to help you optimize your Linux server performance with tuned.
The tuned daemon can be used to apply system tuning adjustments either dynamically, or statically. There are pre-defined tuning profiles that reflect particular workload requirements.
Available profiles you can tune to are:
|balanced||Ideal for systems that require a compromise between power saving and performance.|
|desktop||Derived from the balanced profile. Provides faster response of interactive applications.|
|throughput-performance||Tunes the system for maximum throughput.|
|latency-performance||Ideal for server systems that require low latency at the expense of power consumption.|
|network-latency||Derived from the latency-performance profile. It enables additional network tuning parameters to provide low network latency.|
|network-throughput||Derived from the throughput-performance profile. Additional network tuning parameters are applied for maximum network throughput.|
|powersave||Tunes the system for maximum power saving.|
|oracle||Optimized for Oracle database loads based on the throughput-performance profile.|
|virtual-guest||Optimize for running inside a virtual guest|
|virtual-host||Tunes the system for maximum performance if used for running KVM guests|
So let’s look at the two modes of system tuning.
In this tuning method, the tuned daemon applies system settings when the service starts or upon selection of a new tuning profile. It configures predefined kernel parameters in profiles that tuned applies at runtime. The kernel parameters are set for overall performance expectations, and are not adjusted as activity levels change.
With dynamic tuning, the tuned daemon monitors system activity and adjusts settings depending on runtime behavior changes. Dynamic tuning is continuously adjusting tuning to fit the current workload, starting with the initial settings declared in the chosen tuning profile.
In RHEL/CentOS 8/7 Linux system, the tuned package is installed and enabled by default. If you want install and enable the package manually on CentOS / RHEL machine, run the commands:
sudo yum install tuned sudo systemctl enable --now tuned
Ubuntu / Debian:
sudo apt update sudo apt install tuned tuned-utils tuned-utils-systemtap
Confirm services status after starting it.
$ 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 Tue 2020-02-04 04:10:52 UTC; 6 days ago Docs: man:tuned(8) man:tuned.conf(5) man:tuned-adm(8) Main PID: 936 (tuned) CGroup: /system.slice/tuned.service └─936 /usr/bin/python2 -Es /usr/sbin/tuned -l -P .....
Selecting a Tuning Profile
The Tuned profiles are divided into the following categories:
- Performance-boosting profiles
- Power-saving 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
- Virtualization host performance
- Virtual machine performance
We’ll use the tuned-adm command to change settings of the tuned daemon.
Check currently active tuning profile:
$ tuned-adm active Current active profile: virtual-guest
The tuned-adm list command is used to list all available tuning profiles:
Available profiles: - 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: virtual-guest
On an Ubuntu, more profiles are available:
$ tuned-adm list Available profiles: - atomic-guest - Optimize virtual guests based on the Atomic variant - atomic-host - Optimize bare metal systems running the Atomic variant - balanced - General non-specialized tuned profile - cpu-partitioning - Optimize for CPU partitioning - default - Legacy default tuned profile - desktop - Optimize for the desktop use-case - desktop-powersave - Optmize for the desktop use-case with power saving - enterprise-storage - Legacy profile for RHEL6, for RHEL7, please use throughput-performance profile - laptop-ac-powersave - Optimize for laptop with power savings - laptop-battery-powersave - Optimize laptop profile with more aggressive power saving - 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 - oracle - Optimize for Oracle RDBMS - powersave - Optimize for low power consumption - realtime - Optimize for realtime workloads - realtime-virtual-guest - Optimize for realtime workloads running within a KVM guest - realtime-virtual-host - Optimize for KVM guests running realtime workloads - sap-hana - Optimize for SAP HANA - sap-hana-vmware - Optimize for SAP HANA running inside a VMware guest - sap-netweaver - Optimize for SAP NetWeaver - server-powersave - Optimize for server power savings - spindown-disk - Optimize for power saving by spinning-down rotational disks - 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
The tuned-adm profile <profile> command is used to switch the active profile to a different one. This example will tune our system for maximum throughput.
sudo tuned-adm profile throughput-performance
Confirm current profile.
$ sudo tuned-adm active Current active profile: throughput-performance
Check recommended tuning profile for the system
The tuned-adm command can also recommend a tuning profile for the system. This is based on various system characteristics, including whether the system is a virtual machine and other predefined categories selected during system installation.
$ tuned-adm recommend virtual-guest
You can then set your profile to recommended value.
sudo tuned-adm profile virtual-guest
To see profile details, run:
$ tuned-adm profile_info virtual-guest Profile name: virtual-guest Profile summary: Optimize for running inside a virtual guest Profile description:
Switching off profile
To revert the setting changes made by the current profile, either switch to another profile or deactivate the tuned daemon.
Use the tuned-adm off command to turn off tuned tuning activity:
$ tuned-adm off
Confirm with the command:
$ tuned-adm active
You can also manage Tuning profiles with Cockpit Web Console.