Linux_Performance_Tuning

Linux_Performance_Tuning

Linux Performance tuning

 

Using tuned profile we can tune. Tuned is a daemon that uses udev to monitor connected devices and statically and dynamically tunes system settings according to a selected profile. Tuned is distributed with a number of predefined profiles for common use cases like high throughput, low latency, or power save. It is possible to modify the rules defined for each profile and customize how to tune a particular device.

For tuning Linux we have various tools.

 

Using “tuned-adm”  command line tool for switching between different tuning profiles.

To list out all the available profile.

[root@feenixdv docker]# tuned-adm list
Available profiles:
- balanced                    - General non-specialized tuned profile
- desktop                     - Optmize for the desktop use-case
- 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.
- powersave                   - Optimize for low power consumption
- throughput-performance      - Broadly applicable tuning that provides excellent performance across a variety of common server workloads.  This is the default profile for RHEL7.
- virtual-guest               - Optimize for running inside a virtual guest.
- virtual-host                - Optimize for running KVM guests
Current active profile: virtual-guest

The main configuration file of tuned are located under «/etc/tuned/” and “/usr/lib/tuned/”

[root@feenixdv ~]# ll /etc/tuned/
total 12
-rw-r--r--. 1 root root  14 Jan 21 22:29 active_profile
-rw-r--r--. 1 root root 779 Oct 17  2014 bootcmdline
-rw-r--r--. 1 root root 387 Mar  6  2015 tuned-main.conf
[root@feenixdv ~]# ll /usr/lib/tuned/
total 16
drwxr-xr-x. 2 root root    23 Jan 22  2019 balanced
drwxr-xr-x. 2 root root    23 Jan 22  2019 desktop
-rw-r--r--. 1 root root 12147 Oct 15  2014 functions
drwxr-xr-x. 2 root root    23 Jan 22  2019 latency-performance
drwxr-xr-x. 2 root root    23 Jan 22  2019 network-latency
drwxr-xr-x. 2 root root    23 Jan 22  2019 network-throughput
drwxr-xr-x. 2 root root    39 Jan 22  2019 powersave
-rw-r--r--. 1 root root   601 Oct 17  2014 recommend.conf
drwxr-xr-x. 2 root root    23 Jan 22  2019 throughput-performance
drwxr-xr-x. 2 root root    23 Jan 22  2019 virtual-guest
drwxr-xr-x. 2 root root    23 Jan 22  2019 virtual-host

And profile configuration file look like.

[root@feenixdv ~]# cat /usr/lib/tuned/balanced/tuned.conf
#
# tuned configuration
#
[cpu]
governor=conservative
energy_perf_bias=normal


timeout=10


radeon_powersave=auto

[disk]
# Comma separated list of devices, all devices if commented out.
# devices=sda
alpm=medium_power

To check the profile effect we have “tuna” GUI tool. You can install from ISO image.

Test case with “balanced”

Test case with “desktop”

Test case with “latency-performance”

Test case with “network-throughput”

Test case with “powersave

Test case with “virtual-host”

Get tuned recommendation

To let tuned recommend you the best suitable profile for your system without changing any existing profiles and using the same logic as used during the installation, run the following command:

# tuned-adm recommend
virtual-guest

 

Create a custom tuned profile

# mkdir /etc/tuned/feenixdv
Create a new tuned.conf file for feenixdv, and insert new tuning info.
# vi /etc/tuned/feenixdv/tuned.conf
[main]
summary=This is a test tuned profile

[cpu]
force_latency=1

[vm]
transparent_hugepages=never

[sysctl]
kernel.sysrq=1
vm.nr_hugepages=4100
kernel.numa_balancing=0

[script]
script=/etc/tuned/feenixdv/myscript.sh

Here I have created a custom tuned profile which performs below list of functions

  • limit C-state usage to C1
  • disable transparent hugepages
  • allocate 4100 2MB static hugepages
  • disable automatic numa balancing
  • run an arbitrary shell script

The content of an example myscript.sh script:

#!/bin/sh
OPERATION=$1
if [ $OPERATION -eq "start" ];
    then
            touch /tmp/$OPERATION
else
            touch /tmp/$OPERATION
fi

Provide executable permission to the tuned profile

# chmod +x /etc/tuned/feenixdv/tuned.conf

Next, enable the new profile

# tuned-adm profile feenixdv

Check the currently active profile

# tuned-adm active

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *