Using Tuned Profiles
Introduction to Tuned
Tuned is focused on system tuning and optimization.
Found in the
procdirectory within the proc pseudo file system.Contains tunable parameters that govern various system settings.
Allows for the modification of the current values of these tunables by echoing new values into files.
System Tuning
To make it persistent:
echo 40 > /proc/sys/vm/swappiness.Changing parameters via the
procfile system requires expertise.
Purpose of Tuned
Tuned simplifies the tuning process.
It is a systemd service designed for easier management.
Utilizes different profiles suitable for specific workloads.
Profiles in Tuned
Profiles correspond to various use cases (e.g., virtual guest).
Example command to show current profiles:
tuned-adm list.Command to set a specific profile (e.g., for virtualization):
tuned-adm profile virtual-guest.Each profile includes a configuration file within
/etc/tuned/<profile_name>/tuned.conf.These configuration files hold critical performance-related settings.
Managing Tuning Information
Deciding whether to use Tuned or sysctl and the proc file system:
Controlled by
reapply_sysctloption in/etc/tuned/tuned-main.conf:Set to
1: sysctl settings take precedence in case of conflicts.Set to
0: Tuned settings take precedence.
Creating Custom Profiles
Custom profiles can be created easily.
Store these profiles in the directory
/etc/tuned/profiles/.Each custom profile requires a subdirectory and a
tuned.conffile with performance settings.
Demonstration of Tuned Setup
Install Tuned with:
dnf install -y tuned.Enable the Tuned service with:
systemctl enable --now tuned.Check active profiles using:
tuned-adm list.The current profile, post-installation, is typically set to
balanced.To ask the system for better profile recommendations:
tuned-adm recommend.Example output indicates that
virtual-guestmight be a better fit.
Adjusting System Parameters
For adjusting the
vm.swappinessparameter:Use command:
echo vm.swappiness=33 > /etc/sysctl.d/swappiness.conf.vm.swappinessaffects memory handling during low memory conditions:Values near 0: System reduces inactive cache to avoid swapping.
Values near 200: System favors moving inactive application memory to swap.
To activate the new setting use:
sysctl -p /etc/sysctl.d/swappiness.conf.To verify the setting, you can execute:
sysctl -a | grep swappiness.
Largest Number of Sysctl Parameters
The system can contain a vast number of tunable parameters, for example, 1,068 parameters available for tuning.
Creating and Activating Custom Profile
To create a profile tagged as
my_profile, use the following commands:Create directory:
mkdir /etc/tuned/profiles/my_profileGenerate configuration file:
echo > /etc/tuned/profiles/my_profile/tuned.conf.Shebang and settings headers can be added:
sysctlas header and setvm.swappiness=66.
Exit interactive prompt when done (indicated by EOF).
Activating the Custom Profile
Check if the new profile is picked using:
tuned-adm list.To activate it:
tuned-adm profile my_profile.Confirm activation via checking the active profile using last line of
tuned-adm list.
Final Verification of Parameters
Check resultant parameter (swappiness in this case) to confirm settings:
Use command:
sysctl -a | grep swapto see the value ofvm.swappinessas33.The overriding factor is determined by
reapply_sysctlsettings withintuned-main.conf.If
reapply_sysctlis set to1: sysctl settings take precedence (as explained).Setting
reapply_sysctlto0causes Tuned settings to dominate, requiring a service restart for changes to take effect.