Bookmark this page

Lab: Tune System Performance

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

Important

This lab uses commands that perform an endless checksum on a device file and intentionally use significant CPU resources.

Instructions

  1. 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.

    1. Log in to the serverb machine as the student user.

      [student@workstation ~]$ ssh student@serverb
      ...output omitted...
      [student@serverb ~]$
    2. Verify that the tuned package is installed.

      [student@serverb ~]$ dnf list tuned
      ...output omitted...
      Installed Packages
      tuned.noarch              2.18.0-1.el9                 @System
    3. Verify the tuned service state.

      [student@serverb ~]$ systemctl is-active tuned
      active
    4. 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: student
      Available 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
    5. Change the current active tuning profile to the balanced profile.

      [student@serverb ~]$ sudo tuned-adm profile balanced
    6. List summary information of the current active tuned profile. Verify that the active profile is the balanced profile.

      [student@serverb ~]$ sudo tuned-adm profile_info
      Profile name:
      balanced
      
      Profile summary:
      General non-specialized tuned profile
      ...output omitted...
  2. 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.

    1. 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=pcpu
      USER    PID %CPU %MEM    VSZ   RSS TTY    STAT START   TIME COMMAND
      ...output omitted...
      root    1079 98.5  0.1 225340  2300 ?     RN   06:25   4:29 sha1sum /dev/zero
      root    1095 99.0  0.1 225340  2232 ?     R<   06:25   4:30 md5sum /dev/zero
    2. 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 %CPU  NI COMMAND
       1079 98.8   2 sha1sum
       1095 99.1  -2 md5sum
    3. 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 1079 1095
      [sudo] password for student: student
      1079 (process ID) old priority 2, new priority 10
      1095 (process ID) old priority -2, new priority 10
    4. Verify that the current nice level for each process is 10.

      [student@serverb ~]$ ps -o pid,pcpu,nice,comm \
      $(pgrep sha1sum;pgrep md5sum)
        PID %CPU  NI COMMAND
       1079 98.9  10 sha1sum
       1095 99.2  10 md5sum
    5. Return to the workstation machine as the student user.

      [student@serverb ~]$ exit
      logout
      Connection to serverb closed.
      [student@workstation ~]$

      Important

      Verify that you have terminated all lab processes before leaving this lab.

Evaluation

As the student user on the workstation machine, use the lab command to grade your work. Correct any reported failures and rerun the command until successful.

[student@workstation ~]$ lab grade tuning-review

Finish

On the workstation machine, change to the student user home directory and use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish tuning-review

Revision: rh199-9.3-8dd73db