Transparent Huge Pages (THP) was introduced in RHEL 6. However, it wasn't turned on by default until RHEL 7. Even though THP is supposed to increase memory performance, various database vendors including Oracle, MariaDB, Redis have recommended that you turn off THP. It seems to cause performance degradation when THP is enabled.
To verify if THP is enabled.
# cat /sys/kernel/mm/transparent_hugepage/defrag [always] madvise never # cat /sys/kernel/mm/transparent_hugepage/enabled [always] madvise never
Edit the rc.local file
Add the following to the bottom of /etc/rc.d/rc.local
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then echo never > /sys/kernel/mm/transparent_hugepage/enabled fi if test -f /sys/kernel/mm/transparent_hugepage/defrag; then echo never > /sys/kernel/mm/transparent_hugepage/defrag fi
Make rc.local file executable
chmod u+x /etc/rc.d/rc.local
# shutdown -r now
To verify that THP is disabled.
# cat /sys/kernel/mm/transparent_hugepage/defrag always madvise [never] # cat /sys/kernel/mm/transparent_hugepage/enabled always madvise [never]