RHCSA Rapid Track
Course update
An updated version of this course is available that uses a newer version of Red Hat Enterprise Linux in the lab environment. Therefore, the RHEL 9.0 version of the lab environment will retire on December 31, 2024. Please complete any work in this lab environment before it is removed on December 31, 2024. For the most up-to-date version of this course, we recommend moving to the RHEL 9.3 version.
In this exercise, you tune server performance by activating the tuned service and applying a tuning profile.
Outcomes
Configure a system to use a tuning profile.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command prepares your environment and ensures that all required resources are available.
[student@workstation ~]$ lab start tuning-profiles
Instructions
Log in to
serveraas thestudentuser.[student@workstation ~]$
ssh student@servera...output omitted... [student@servera ~]$Verify that the
tunedpackage is installed, enabled, and started.Verify that the
tunedpackage is installed.[student@servera ~]$
dnf list tuned...output omitted... Installed Packagestuned.noarch2.18.0-1.el9 @SystemVerify that the service is enabled.
[student@servera ~]$
systemctl is-enabled tunedenabledVerify that the service is currently running.
[student@servera ~]
systemctl is-active tunedactive
List the available tuning profiles and identify the active profile.
[student@servera ~]$
sudo tuned-adm list[sudo] password for student:studentAvailable 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 - intel-sst - Configure for Intel Speed Select Base Frequency - 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 - optimize-serial-console - Optimize for serial console use. - 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-guestReview the
tuned.confconfiguration file for the current active profile,virtual-guest. You can find thetuned.confconfiguration file in the/usr/lib/tuned/virtual-guestdirectory. Thevirtual-guesttuning profile is based on thethroughput-performanceprofile, but it sets different values for thevm.dirty_ratioandvm.swappinessparameters. Verify that thevirtual-guesttuning profile applies these values on your system.Review the
virtual-guestconfiguration file in the/usr/lib/tuned/virtual-guestdirectory. Verify the values for thevm.dirty_ratioandvm.swappinessparameters.[student@servera ~]$
cat /usr/lib/tuned/virtual-guest/tuned.conf# # tuned configuration # [main] summary=Optimize for running inside a virtual guest include=throughput-performance [sysctl] # If a workload mostly uses anonymous memory and it hits this limit, the entire # working set is buffered for I/O, and any more write buffering would require # swapping, so it's time to throttle writes until I/O can catch up. Workloads # that mostly use file mappings may be able to use even higher values. # # The generator of dirty data starts writeback at this percentage (system default # is 20%)vm.dirty_ratio = 30# Filesystem I/O is usually much more efficient than swapping, so try to keep # swapping low. It's usually safe to go even lower than this on systems with # server-grade storage.vm.swappiness = 30Verify that the tuning profile applies these values on your system.
[student@servera ~]$
sysctl vm.dirty_ratiovm.dirty_ratio = 30 [student@servera ~]$sysctl vm.swappinessvm.swappiness = 30
Review the
tuned.confconfiguration file for thevirtual-guestparent's tuning profile,throughput-performance. You can find it in the/usr/lib/tuned/throughput-performancedirectory. Notice that thethroughput-performancetuning profile sets a different value for thevm.dirty_ratioandvm.swappinessparameters, although thevirtual-guestprofile overwrites them. Verify that thevirtual-guesttuning profile applies the value for thevm.dirty_background_ratioparameter, which it inherits from thethroughput-performanceprofile.Review the
throughput-performanceconfiguration file in the/usr/lib/tuned/throughput-performancedirectory. Verify the values for thevm.dirty_ratio,vm.swappiness, andvm.dirty_background_ratioparameters.[student@servera ~]$
cat /usr/lib/tuned/throughput-performance/tuned.conf# # tuned configuration # [main] summary=Broadly applicable tuning that provides excellent performance across a variety of common server workloads ...output omitted... [sysctl] # If a workload mostly uses anonymous memory and it hits this limit, the entire # working set is buffered for I/O, and any more write buffering would require # swapping, so it's time to throttle writes until I/O can catch up. Workloads # that mostly use file mappings may be able to use even higher values. # # The generator of dirty data starts writeback at this percentage (system default # is 20%)vm.dirty_ratio = 40# Start background writeback (via writeback threads) at this percentage (system # default is 10%)vm.dirty_background_ratio = 10# PID allocation wrap value. When the kernel's next PID value # reaches this value, it wraps back to a minimum PID value. # PIDs of value pid_max or larger are not allocated. # # A suggested value for pid_max is 1024 * <# of cpu cores/threads in system> # e.g., a box with 32 cpus, the default of 32768 is reasonable, for 64 cpus, # 65536, for 4096 cpus, 4194304 (which is the upper limit possible). #kernel.pid_max = 65536 # The swappiness parameter controls the tendency of the kernel to move # processes out of physical memory and onto the swap disk. # 0 tells the kernel to avoid swapping processes out of physical memory # for as long as possible # 100 tells the kernel to aggressively swap processes out of physical memory # and move them to swap cachevm.swappiness=10...output omitted...Verify that the
virtual-guesttuning profile applies the inheritedvm.dirty_background_ratioparameter.[student@servera ~]$
sysctl vm.dirty_background_ratiovm.dirty_background_ratio = 10
Change the current active tuning profile to
throughput-performance, and then confirm the results. Verify that thevm.dirty_ratioandvm.swappinessparameters change to the values in thethroughput-performanceconfiguration file.Change the current active tuning profile.
[student@servera ~]$
sudo tuned-adm profile throughput-performanceConfirm that
throughput-performanceis the active tuning profile.[student@servera ~]$
sudo tuned-adm activeCurrent active profile:throughput-performanceVerify the values for the
vm.dirty_ratioandvm.swappinessparameters.[student@servera ~]$
sysctl vm.dirty_ratiovm.dirty_ratio = 40 [student@servera ~]$sysctl vm.swappinessvm.swappiness = 10
Return to the
workstationmachine as thestudentuser.[student@servera ~]$
exitlogout Connection to servera closed. [student@workstation ~]$
This concludes the section.