Although there are a number of different profiles within tuned, there may be a need for a customized profile that meets a specific tuning case. How do I create a customized tuned profile? How do I set deadline IO scheduler for disk devices using custom tuned profile in RHEL 7? How can I change disk elevators using tuned?
In CentOS/RHEL 7, tuned has been largely re-written and significantly extended to provide additional functionality and capabilities. Profiles have also been updated to account for new features delivered in RHEL 7. One of the most visible changes is the consolidation of configuration files from a set of 4 (in RHEL 6) down to a single tuned.conf file in RHEL 7. The location of the default tuned profiles has also moved from /etc/tune-profiles to /usr/lib/tuned:
./balanced/tuned.conf ./desktop/tuned.conf ./latency-performance/tuned.conf ./powersave/script.sh ./powersave/tuned.conf ./throughput-performance/tuned.conf ./virtual-guest/tuned.conf ./virtual-host/tuned.conf ./network-latency/tuned.conf ./network-throughput/tuned.conf
The following steps could be used to create a custom tuned profile that would change the disk IO scheduler to deadline:
For CentOS/RHEL 6
The default I/O scheduler for RHEL 6 is CFQ. The following steps demonstrate creating a custom profile and setting the deadline I/O scheduler.
1. Locate the tuned profile directory:
# cd /etc/tune-profiles
2. Find a profile that closely matches the desired tuning (for example, “throughput-performance”):
# cp -rp throughput-performance throughput-performance-custom # cd throughput-performance-custom
3. Make any required changes to the profile. For example, change the disk elevator from cfq to deadline:
# vi ktune.sysconfig ELEVATOR="deadline"
For CentOS/RHEL 7
Unlike RHEL 6, the default I/O scheduler for RHEL 7 is now deadline. Since the default is already deadline the following steps demonstrate creating a custom profile and setting the noop I/O scheduler.
1. Create a new directory to hold your profile in /etc/tuned (Note: Profiles provided by the tuned rpm are stored in /usr/lib/tuned but all user-configured profiles should be stored in /etc):
# mkdir /etc/tuned/myprofile
2. Create a new tuned.conf file for myprofile, and insert new tuning info. For this example, to set the IO scheduler to noop and include all the tuning from the existing “throughput-performance” profile, set elevator=noop option under [disk] section:
# vi /etc/tuned/myprofile/tuned.conf [main] include=throughput-performance [disk] elevator=noop
3. Enable myprofile:
# tuned-adm profile myprofile
4. This change will immediately take effect and persist reboots.
5. After running above command, verify that deadline IO scheduler is selected for disk devices:
# cat /sys/block/sda/queue/scheduler [noop] deadline cfq
Longer version of the example customized tuned.conf with a call-out to an external script:
# vi /etc/tuned/myprofile/tuned.conf [main] include=throughput-performance [cpu] force_latency=1 [vm] transparent_hugepages=never [disk] elevator=deadline [sysctl] kernel.sysrq=1 sysctl vm.nr_hugepages=4100 kernel.numa_balancing=0 [script] script=/etc/tuned/myprofile/myscript.sh
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