Note_Tech

All technological notes.


Project maintained by simonangel-fong Hosted on GitHub Pages — Theme by mattgraham

Linux - System: Tune System Performance

Back


Tune System Performance


Package tuned: Tuning by Profiles

rpm -qa | grep tuned
sudo yum install tuned
sudo systemctl status tuned
sudo systemctl enable --now tuned
/etc/tuned

Predefined Profiles

Profile Description
balanced Default profile balancing performance and power consumption.
throughput-performance Optimized for high throughput workloads (e.g., databases, web servers).
latency-performance Optimized for low latency workloads (e.g., real-time applications).
powersave Minimizes power consumption, suitable for laptops or energy-efficient setups.
virtual-guest Optimized for virtual machines running as guests.
virtual-host Optimized for virtualization hosts managing VMs.
desktop Optimized for desktop systems, improving responsiveness.
network-latency Optimized for low-latency network environments.
network-throughput Optimized for high-throughput network environments.
oracle Optimized for Oracle database workloads.
hpc-compute Optimized for high-performance computing (HPC) environments.

Command

CMD DESC
tuned-adm list List Available Profiles
tuned-adm active Show Current Active Profile
tuned-adm recommend Recommend an Optimal Profile for the System
tuned-adm profile profile_name Switch to a desired Profile
tuned-adm off Turn Off Tuning

Lab: Tune System Performance by tuned

List all profiles and check active profile

# Check Current Active Profile
tuned-adm active
# Current active profile: virtual-guest

# List Available Profiles
tuned-adm list
# Available profiles:
# - accelerator-performance     - Throughput performance based tuning with disabled higher latency STOP states
# - aws                         - Optimize for aws ec2 instances
# - balanced                    - General non-specialized tuned profile
# - desktop                     - Optimize for the desktop use-case
# - epyc-eda                    - Optimize for EDA compute workloads on AMD EPYC CPUs
# - 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

Swith current profile

# switch to a profile
tuned-adm profile balanced
# confirm
tuned-adm active
# Current active profile: balanced

# turn off tuned, means run system manually
tuned-adm off
# confirm, by checking the current profile
tuned-adm active
# No current active profile.

# get the recommended profile
tuned-adm recommend
# virtual-guest

# switch to recommended profile
tuned-adm profile virtual-guest
# confirm
tuned-adm active
# Current active profile: virtual-guest

Change profile via web console

tuned_web01

tuned_web01


Command nice and renice: Tuning by Priority of Processes


Niceness and Priority



Check Niceness of Running Processes

ps axo pid,comm,nice,cls --sort=-nice
#   PID COMMAND          NI CLS
#    50 khugepaged       19  TS
#    49 ksmd              5  TS
#   970 rtkit-daemon      1  TS
#     1 systemd           0  TS
#     2 kthreadd          0  TS
#     6 kworker/0:0-eve   0  TS
#    11 rcu_tasks_rude_   0  TS
#    12 rcu_tasks_trace   0  TS
#    13 ksoftirqd/0       0  TS
#    14 rcu_sched         0  TS
#    15 migration/0       -  FF
#    16 watchdog/0        -  FF
#    17 cpuhp/0           0  TS
#    18 cpuhp/1           0  TS
#    19 watchdog/1        -  FF
#    20 migration/1       -  FF
#    21 ksoftirqd/1       0  TS
#    24 cpuhp/2           0  TS
#    25 watchdog/2        -  FF
#    26 migration/2       -  FF

Command

CMD DESC
nice process_name Run a Command with Default Niceness (0)
nice -n 10 process_name Run a Command with a Specific Niceness Value
renice -n 10 1234 Change the Niceness of a Process
renice 10 -p 1234 Change the Niceness of a Process
renice 5 -p 1234 5678 Change Niceness for Multiple Processes
renice 10 -u username Change Niceness for All Processes of a User
renice 5 -g 123 Change Niceness for a Process Group

Lab: Tuning by Prioritize Process

# sets the process niceness to 15, making it less CPU-intensive.
nice -n 15 tar -czf backup.tar.gz /data

# run top by default, NI is 0
top
#     PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
#   11759 root      20   0  264296   4532   3652 R   0.7   0.1   0:00.04 top

# Run a Command with High Priority, NI is -5
sudo nice -n -5 top
#     PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
#   11996 root      15  -5  264296   4656   3776 R   1.0   0.1   0:00.17 top

# adjust priority of a process
renice -n 15 11996
# top display:
#     PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
#   11996 root      35  15  264296   4656   3776 R   0.7   0.1   0:00.35 top

TOP