More and more, questions arise around SAP IQ support of hugepages in the Linux kernel.
There are two types of hugepages in the Linux kernel. Traditional hugepages in which the application must specifically be compiled to use and transparent hugepages which is an OS level tuning mechanism for large memory programs in which no changes are needed to the application.
The following sections outline SAP IQ’s use of the different types of hugepages and how they should be configured in the kernel.
HugePages (traditional HugePages)
Hugepages is a mechanism that allows the Linux kernel to utilize the multiple page size capabilities of modern hardware architectures. Linux uses pages as the basic unit of memory, where physical memory is partitioned and accessed using the basic page unit. The default page size is 4096 Bytes in the x86 architecture. Hugepages allows large amounts of memory to be utilized with a reduced overhead. Linux uses “Transaction Lookaside Buffers” (TLB) in the CPU architecture. These buffers contain mappings of virtual memory to actual physical memory addresses. So utilizing a huge amount of physical memory with the default page size consumes the TLB and adds processing overhead.
SAP IQ does not currently use HugePages. As such, it is imperative that the Linux kernel not be configured to allocate memory for HugePages use. Any memory that is allocated to HugePages cannot be used by SAP IQ.
A default configured Linux system will typically have just a few MB of memory dedicated to HugePages. The amount can be determined by running this command:
cat /proc/meminfo |grep Hugepagesize
It will typically return this value:
Hugepagesize: 2048 kB
Should more than just a few MB of memory be allocated to HugePages, it is strongly recommended to change the kernel configuration be set back to default by removing the HugePages options from /etc/sysctl.conf.
For details on HugePages in the Linux kernel, refer to this write-up: https://www.kernel.org/doc/Documentation/vm/hugetlbpage.txt
Starting from RHEL6 and SUSE 11, Transparent HugePages are implemented and enabled by default. They are meant to improve memory management by allowing HugePages to be allocated dynamically by the "khugepaged" kernel thread, rather than at boot time like conventional HugePages. In certain circumstances, Transparent HugePages have shown to negatively impact SAP IQ performance. It is strongly recommended to disable Transparent HugePages for SAP IQ systems until this OS feature can be fully tested under the client specific workload.
The performance issue with Transparent HugePages typically manifests itself in the form of high system time. Using tools like vmstat and top, monitor the user, system, wait, and idle CPU utilization. The high system utilization is a result of the memory manager as described at https://www.kernel.org/doc/Documentation/vm/transhuge.txt: “As the system ages, allocating huge pages may be expensive as the system uses memory compaction to copy data around memory to free a huge page for use.”
Should the system CPU utilization increase over time, it is possible that the OS is having to spend more time managing the Transparent HugePages and Anonymous memory segments. Disabling Transparent HugePages can alleviate that bottleneck.
Details on Transparent HugePages can be found here:
Details on disabling Transparent HugePages can be found in the “== Boot parameter ==” section of the previous link.
The recommendation is to use the “transparent_hugepage=never” option in the Linux kernel boot loader file.