Summary

There are 3 directories responsible for system tuning.

  • /proc/sys contians the current system parameters
  • /etc/sysctl.d/ *.conf if you write the system parameter to a conf file inside this it will be persistent
  • /etc/tuned/
    • /etc/tuned/main.conf has settings about tuned
    • /etc/tuned/profiles/<profile>/main.conf you can create tuned profiles like this
  • we use tuned to do system tuning in RHEL
  • Kernel tunables are provided through the /proc/sys directory in the /proc pseudo file system
  • if you want to see all the system tuning parameters,
sysctl -a
  • this will show all the parameters,

  • to see how many parameters are there

  • if you want to see the value of a parameter,

  • Different files in the /proc/sys directory contain the current setting as its value

  • Change the current value by echoing a new value into the file:

echo 40 > /proc/sys/vm/swappiness
  • but if you write to /proc/sys it is not persistent.

  • To make settings persistent, write them to a file in /etc/sysctl.d:

  • now this will persist even after a reboot.

  • if you want to make it available immedietly then you have to use sysctl -p

sysctl -p /etc/sysctl.d/swappiness.conf

or you can use

sysctl --system

  • since there are a lot of tunable parameters, it is hard to manage all of them just by writing to files.

  • To make system tuning easier, tuned is provided

  • tuned is a systemd service that works with different profiles tuned-adm list shows current profiles

  • tuned-adm profile virtual-guest sets another profile as default.

  • to see the active profile you can use

tuned-adm active
  • Each profile contains a file with the name tuned.conf, that has a wide range of performance related settings
  • After creating the directory with the corresponding tuned.conf, it will automatically be picked up
  • if you want to see recommend tuned profile
tuned-adm recommend

  • The reapply_sysctl = 1 parameter in /etc/tuned/tuned-main.conf ensures that, in case of conflict, the sysctl parameter wins

  • tuned --help will provide an overview of all the commands that you can use.

  • if you want to create your own tuned profile you can create it like this

  • you only need to create the profile. it will automatically will be picked up by tuned

  • remember sysctl will win over tuned. if you want to change that behavior you have to set reapply_sysctl = 0 in /etc/tuned/main.conf

How to see all the tunables in a systemd units?

systemctl show httpd.service