Tuning System Performance
Tuning System Performance
Tuned
Purpose
Profile
throughput-
performance
Tunes the system for maximum throughput.
latency- Ideal for server systems that require low latency at the expense of
performance power consumption.
throughput.
The tuned-adm command is used to change settings of the tuned daemon. The tuned-adm
command can query current settings, list available profiles, recommend a tuning profile for
the system, change profiles directly, or turn off tuning.
A system administrator identifies the currently active tuning profile with tuned-adm active.
The tuned-adm list command lists all available tuning profiles, including both built-in
profiles and custom tuning profiles created by a system administrator.
Use tuned-adm profile profilename to switch the active profile to a different one that
better matches the system's current tuning requirements.
The tuned-adm command can recommend a tuning profile for the system. This mechanism is
used to determine the default profile of a system after installation.
[root@host ~]$ tuned-adm recommend
virtual-guest
To revert the setting changes made by the current profile, either switch to another profile or
deactivate the tuned daemon. Turn off tuned tuning activity with tuned-adm off.
List the available tuning profiles and identify the active profile. If sudo prompts for a
password, enter student after the prompt.
Change the current active tuning profile to powersave, then confirm the results. If sudo
prompts for a password, enter student after the prompt.
Change the current active tuning profile.
[student@servera ~]$ sudo tuned-adm profile powersave
The nice level values range from -20 (highest priority) to 19 (lowest priority). By default,
processes inherit their nice level from their parent, which is usually 0. Higher nice levels
indicate less priority (the process easily gives up its CPU usage), while lower nice levels
indicate a higher priority (the process is less inclined to give up the CPU). If there is no
contention for resources, for example, when there are fewer active processes than available
CPU cores, even processes with a high nice level will still use all available CPU resources
they can. However, when there are more processes requesting CPU time than available
cores, the processes with a higher nice level will receive less CPU time than those with a
lower nice level.
Use the top command to interactively view and manage processes. The default configuration
displays two columns of interest about nice levels and priorities. The NI column displays the
process nice value and the PR column displays its scheduled priority. In the top interface, the
nice level maps to an internal system priority queue as displayed in the following graphic.
For example, a nice level of -20 maps to 0 in the PR column. A nice level of 19 maps to a
priority of 39 in the PR column.
The nice command can be used by all users to start commands with a default or higher nice
level. Without options, the nice command starts a process with the default nice value of 10.
The following example starts the sha1sum command as a background job with the default
nice level and displays the process's nice level:
Use the -n option to apply a user-defined nice level to the starting process
[1] 3521
PID COMMAND NI
3521 sha1sum 15
The top command can also be used to change the nice level on a process. From within the
top interactive interface, press the r option to access the renice command, followed by the
PID to be changed and the new nice level.
Determine the number of CPU cores on servera and then start two instances of the sha1sum
/dev/zero & command for each core.
Use grep to parse the number of existing virtual processors (CPU cores) from the
/proc/cpuinfo file.
Verify that the background jobs are running for each of the sha1sum processes.
Use the ps and pgrep commands to display the percentage of CPU usage for each sha1sum
process.
Terminate all sha1sum processes, then verify that there are no running jobs.
1. Use the pkill command to terminate all running processes with the name pattern
sha1sum.
[1] 1947
[2] 1948
[3] 1949
Use the nice command to start the fourth instance with a 10 nice level.
Use the ps and pgrep commands to display the PID, percentage of CPU usage, nice value,
and executable name for each process. The instance with the nice value of 10 should display
a lower percentage of CPU usage than the other instances.
Use the sudo renice command to lower the nice level of a process from the previous step.
Note the PID value from the process instance with the nice level of 10. Use that process PID
to lower its nice level to 5.
Use the tuned-adm profile_info command to confirm that the active profile is the balanced
profile.
Determine the top two CPU consumers on serverb. The top CPU consumers are listed last
in the command output. CPU percentage values will vary.
Identify the current nice level for each of the top two CPU consumers.
Use the sudo renice -n 10 2967 2983 command to adjust the nice level for each process to
10. Use PID values identified in the previous command output.
Verify that the current nice level for each process is 10.