In this lab, you apply a specific tuning profile and adjust the scheduling priority of an existing process with high CPU usage.
Outcomes
Activate a specific tuning profile for a computer system.
Adjust the CPU scheduling priority of a process.
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-review
This lab uses commands that perform an endless checksum on a device file and intentionally use significant CPU resources.
Instructions
Change the current tuning profile for the serverb machine to the balanced profile, a general non-specialized tuned profile.
List the information for the balanced tuning profile when it is the current tuning profile.
Log in to the serverb machine as the student user.
[student@workstation ~]$ ssh student@serverb
...output omitted...
[student@serverb ~]$Verify that the tuned package is installed.
[student@serverb ~]$dnf list tuned...output omitted... Installed Packagestuned.noarch2.18.0-1.el9 @System
Verify the tuned service state.
[student@serverb ~]$systemctl is-active tunedactive
List all available tuning profiles and their descriptions.
Note that the current active profile is virtual-guest.
[student@serverb ~]$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-guest
Change the current active tuning profile to the balanced profile.
[student@serverb ~]$ sudo tuned-adm profile balancedList summary information of the current active tuned profile.
Verify that the active profile is the balanced profile.
[student@serverb ~]$sudo tuned-adm profile_infoProfile name:balancedProfile summary:General non-specialized tuned profile...output omitted...
Two processes on serverb are consuming a high percentage of CPU usage.
Adjust each process's nice level to 10 to allow more CPU time for other processes.
Determine the top two CPU consumers on the serverb machine.
The ps command lists the top CPU consumers at the bottom of the output.
CPU percentage values might vary on your machine.
[student@serverb ~]$ps aux --sort=pcpuUSERPID%CPU%MEM VSZ RSS TTY STAT START TIMECOMMAND...output omitted... root107998.50.1 225340 2300 ? RN 06:25 4:29sha1sum /dev/zeroroot109599.00.1 225340 2232 ? R< 06:25 4:30md5sum /dev/zero
Identify the current nice level for each of the top two CPU consumers.
[student@serverb ~]$ps -o pid,pcpu,nice,comm \$(pgrep sha1sum;pgrep md5sum)PID %CPUNICOMMAND 1079 98.82sha1sum 1095 99.1-2md5sum
Adjust the nice level for each process to 10.
Use the correct PID values for your processes from the previous command output.
[student@serverb ~]$sudo renice -n 10[sudo] password for student:10791095student1079 (process ID) old priority 2, new priority 10 1095 (process ID) old priority -2, new priority 10
Verify that the current nice level for each process is 10.
[student@serverb ~]$ps -o pid,pcpu,nice,comm \$(pgrep sha1sum;pgrep md5sum)PID %CPUNICOMMAND 1079 98.910sha1sum 1095 99.210md5sum
Return to the workstation machine as the student user.
[student@serverb ~]$ exit
logout
Connection to serverb closed.
[student@workstation ~]$Verify that you have terminated all lab processes before leaving this lab.
This concludes the section.