To offer the best possible performance right from the start, CentOS/RHEL 7 and 8 come with tuned. It offers a daemon that monitors system activity and provides some profiles. In the profiles, an administrator can automatically tune a system for the best possible latency, throughput, or power consumption.
Based on the properties of an installed system, a tuned profile is selected automatically at installation, and after installation, it’s possible to manually change the current profile. Administrators can also change settings in a tuned profile.
“tuned-adm” is a command-line tool that provides a number of different profiles to improve performance.
Below are the profiles provided and supported in CentOS/RHEL 8:
Profile | Use |
---|---|
balanced | The best compromise between power usage and performance |
desktop | Based on the balanced profile, but tuned for better response to interactive applications |
latency-performance | Tuned for maximum throughput |
network-latency | Based on latency-performance, but with additional options to reduce network latency |
network-throughput | Based on throughput-performance, optimizes older CPUs for streaming content |
powersave | Tunes for maximum power saving |
throughput-performance | Tunes for maximum throughput |
virtual-guest | Optimizes Linux for running as a virtual machine |
virtual-host | Optimizes Linux for use as a KVM host |
Apart from the provided profile, we can create custom profiles. You can find the system’s tuned profiles used in /lib/tuned/. When you create your own, create them in /etc/tuned in the same way as they are organized in /lib/tuned. I do not recommend creating new profiles in /etc/tuned with the same name as in /lib/tuned, but if you do, the one in the /etc/tuned directory will be used. It is better to create a new one with a different name, including the one you want to modify, and then make the necessary changes to your new profile.
The recommended profile for Oracle database workloads is “throughput-performance”.
Instaling tuned
1. In my virtualbox, by default “vitual-guest” was set as active profile:
# cd /usr/lib/tuned/ # tuned-adm active Current active profile: virtual-guest
If tuned is not installed, install it using yum
# yum install tuned
2. Enable tuned service to ensure it is started upon boot time:
# systemctl enable tuned.service
3. Start the tuned service:
# systemctl start tuned.service
To check the status of tuned service
Verify the service status:
# systemctl status tuned.service
Creating new profile “oracle”
1. Now, let’s create new “oracle” profile to be used. First, create oracle directory:
# mkdir /usr/lib/tuned/oracle
2. Create tuned.conf:
# vi /usr/lib/tuned/oracle/tuned.conf # # tuned configuration # [main] include=throughput-performance [sysctl] vm.swappiness = 1 vm.dirty_background_ratio = 3 vm.dirty_ratio = 80 vm.dirty_expire_centisecs = 500 vm.dirty_writeback_centisecs = 100 kernel.shmmax = 4398046511104 kernel.shmall = 1073741824 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 fs.file-max = 6815744 fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 kernel.panic_on_oops = 1 [vm] transparent_hugepages=never
3. Activate the newly added oracle profile:
# tuned-adm profile oracle # sysctl -a | grep vm.swappiness vm.swappiness = 1
# sysctl -a | grep vm.dirty_ratio vm.dirty_ratio = 80
4. To view the profile list:
# tuned-adm list
One of the benefits of tuned is the profiles can be applied dynamically. To configure dynamic tuning behavior, edit the dynamic_tuning parameter in the /etc/tuned/tuned-main.conf file.
If we are using a tuned profile (as shown above) which makes system settings persistent, it is recommended to remove all the oracle-related entries from /etc/sysctl.conf as the entries are susceptible of being overwritten, replaced or removed altogether.