Loading...

Lab 95: Tuning System Performance

Apply a tuned profile to align system behavior with workload goals, then reduce CPU scheduling pressure by adjusting process priorities with nice and renice. Verify the active profile and confirm your priority changes took effect on running processes.

performance scheduling rhel

Scenario

A host is being repurposed to handle a heavier workload. Your job is to apply a tuned profile appropriate for throughput and then reduce the impact of noisy background CPU jobs by controlling process priorities. You will verify tuned state, start test workloads, and use nice and renice to adjust scheduling priority safely.

Operator context

tuned changes system behavior at a profile level. nice and renice are per-process controls and will not fix a broken workload, but they can keep low-value jobs from competing with critical services.

Objective

  • Install and start tuned.
  • List available tuned profiles and apply a new profile.
  • Verify the currently active profile.
  • Generate CPU load for testing and compare priorities.
  • Start a process with a lower priority using nice.
  • Change a running process nice value using renice.
  • Clean up background workloads.

Concepts

  • tuned applies system-level profile settings, which can affect CPU governor, disk behavior, and other performance-related knobs.
  • nice values influence scheduler priority. Higher nice means lower priority, and lower nice means higher priority.
  • In real ops work, you usually increase nice for background jobs instead of decreasing nice for critical services.
  • Always verify changes with process inspection. Do not assume your intent matched the effective state.

Walkthrough

Step 1 : Install tuned if needed.
Commands
# Debian/Ubuntu
sudo apt install tuned -y

# RHEL/Fedora
sudo dnf install tuned -y

# Arch (if available in your repo set)
sudo pacman -S tuned

tuned is most common in RHEL-family environments, but the workflow is the same: install it, start it, then manage profiles.

# Expected pattern:
Package installs successfully (or reports already installed).
Step 2 : Enable and start tuned.
Commands
sudo systemctl enable --now tuned

This starts profile enforcement and ensures tuned starts on boot.

# Expected pattern:
Active: active (running)
Step 3 : List available tuned profiles.
Commands
tuned-adm list

Look for profiles like balanced , powersave , throughput-performance , and other workload-specific options depending on distro and version.

Step 4 : Apply a throughput-oriented profile.
Commands
sudo tuned-adm profile throughput-performance

This is a common server profile that favors throughput over power savings. Always verify the active profile after changing it.

# Expected pattern:
Profile set to throughput-performance
Step 5 : Confirm the active profile.
Commands
tuned-adm active

Treat this as a verification step before you start process-level tuning.

# Expected pattern:
Current active profile: throughput-performance
Step 6 : Start a CPU-intensive background process.
Commands
yes > /dev/null &

This creates predictable CPU load so you can see how priority changes behave.

# Expected pattern:
Job starts in the background and returns a PID.
Step 7 : Start the same workload at a lower priority using nice.
Commands
nice -n 10 yes > /dev/null &

Higher nice means lower scheduling priority. This is a clean way to ensure a background job competes less aggressively for CPU.

# Expected pattern:
Job starts in the background and returns a PID.
Step 8 : Inspect nice values for the running processes.
Commands
# list PIDs for the test workload
pgrep yes

# verify NI values (NI column shows nice)
ps -o pid,ni,cmd -C yes

You should see one process with NI 0 and one process with NI 10. If you started more than two, stop them and repeat the test with one at a time.

# Expected pattern:
  PID  NI CMD
 1234   0 yes
 5678  10 yes
Step 9 : Adjust a running process nice value with renice.
Commands
# Example: lower the priority of PID 1234 by increasing nice
sudo renice 15 -p 1234

# Verify the change
ps -o pid,ni,cmd -p 1234

In practice, increasing nice values is the safer move for background jobs. Decreasing nice values requires elevated privileges and should be used sparingly.

# Expected pattern:
1234 (process ID) old priority 0, new priority 15
Step 10 : Clean up the test workloads.
Commands
# lab cleanup options
killall yes
# OR
pkill yes

Clean shutdown of test noise matters, especially if you repeat labs frequently.

Common breakpoints

tuned-adm not found

tuned may be installed but not started, or you installed a package set that does not include the CLI tooling. Confirm with rpm -q tuned or dpkg -l tuned and re-check systemctl status tuned .

Profile name differs

Some distros ship different profile sets or names. Use tuned-adm list and choose the closest match to your intent instead of guessing.

ps output does not match

If you see more than two yes processes, your earlier runs are still active. Kill them, then repeat the test so you can compare two processes cleanly.

renice permission denied

Increasing nice values is usually allowed for your own processes, but lowering nice values requires elevated privileges. Use sudo and prefer increasing nice for background workloads.

Cleanup

Stop test workloads and optionally return to a default tuned profile if this host is not intended to run with the throughput profile.

Commands
# stop the lab load
pkill yes

# optional: switch back to a general profile
sudo tuned-adm profile balanced

# verify
tuned-adm active

Reference

  • tuned-adm : Profile management CLI for tuned.
    • list : Show available profiles and selection.
    • profile <name> : Apply a profile.
    • active : Show the active profile.
  • systemctl : Service control for enabling tuned.
    • enable --now tuned : Enable on boot and start immediately.
    • status tuned : Check service state.
  • nice : Start a process with a specific nice value.
    • -n <N> : Set nice value (higher means lower priority).
  • renice : Change nice value of a running process.
    • -p <PID> : Target a specific process ID.
  • ps : Inspect process attributes including NI.
    • -o pid,ni,cmd : Show PID, nice value, and command line.
    • -C <name> : Select by command name.
  • pgrep : Find PIDs by process name.
  • pkill : Stop processes by name (use carefully).
  • killall : Stop processes by name (use carefully).