Transparent Huge Pages (THP) is a feature available in mostly Linux distributions or distro which optimizes large memory of the systems as now days systems (computer systems) are coming with large memory. THP can enhance system performance by mapping memory with large physical pages this can be useful in case system is computing multiple processes, but this can prove adverse performance effect to memory intensive applications such as SAP HANA. In case of SAP HANA THP could cause HANA database hung and you may see symptoms such as HANA database doesn’t respond to requests, or where it is not possible to connect to the database (DB). In such cases disabling of THP is a good idea on those system which are hosting in-memory based database like SAP HANA.
I am working for a customer as a Linux Administrator where Linux servers are hosting SAP application BW and HANA DB. One day I got request from our SAP support team that they were facing issue in HANA DB, after checking I found HANA DB server which is running OS Suse Linux Enterprise Server 12 SP3 (SLES 12 SP3) has THP enabled as madvise.
So, I had to disabled the THP in SLES 12 SP3 server. In this tutorial I will show you how to disable the THP in Linux system I am taking example of SLES 12 but it is applicable for RHEL 7 and CentOS 7 Linux distro also. These steps will require to configure /etc/default/grub file and also will require system reboot so I suggest to have proper system configuration backup and take an adequate downtime for performing this activity.
Steps to disable THP
1. Verify if THP is enabled in system if below output show always or madvise that means THP is enabled in system:
# cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never
2. Append the line “transparent_hugepage=never” in kernel parameter option GRUB_CMDLINE_LINUX_DEFAULT (in some Linux distro you may only see this parameter option GRUB_CMDLINE_LINUX so you can append this line in this parameter also) in file /etc/default/grub:
# egrep -w "transparent_hugepage=never" /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="splash=silent quiet showopts crashkernel=295M transparent_hugepage=never"
#
Example of my SLES 12 SP3 server modified grub configuration, click on this image to see clearly in another browser tab:
3. Take the backup of /boot/grub2/grub.cfg file which will be helpful in restoring the configuration to previous stage in the event of system become unstable due to misconfiguration. After taking backup of file /boot/grub2/grub.cfg rebuild this file with command: grub2-mkconfig -o
4. Reboot the system with below command:
# shutdown -r now
Or
# reboot
5. Once system is up after reboot check the THP disable status from below command it should show THP status as never.
6. You can also verify the boot parameter of kernel after server reboot from below command:
# cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinux-4.4.180-94.113-default root=/dev/mapper/system-root splash=silent quiet showopts crashkernel=295M transparent_hugepage=never
#