Skip to content

Latest commit

 

History

History
122 lines (84 loc) · 5.97 KB

File metadata and controls

122 lines (84 loc) · 5.97 KB

G016 - Host optimization 02 ~ Disabling the transparent hugepages

Understanding the transparent hugepages

Transparent hugepages is a Linux kernel feature intended to improve performance by making more efficient use of your processor’s memory-mapping hardware. This feature gives some applications a small performance boost, but can cause significant latency issues (to database engines for instance) or even apparent memory leaks at worst.

Note

Do not confuse transparent hugepages with explicit hugepages
While transparent hugepages are dynamically reassigned by the kernel to be reused by any compatible application, explicit hugepages are reserved for specific services and render inaccessible to other workloads in the system.

This chapter shows you how to disable the transparent hugepages because:

  • There is no recommended setup for Proxmox VE about this feature.
  • It may not be worth having it enabled in a small server setup (specially on the RAM side) like the one used in this guide.
  • Can provoke serious latency issues in a system when it kicks in to compact fragmented RAM.

Important

Do not completely dismiss using transparent hugepages!
Remember that some applications may benefit from this feature, although they have to be built for it specifically.

Therefore, research the references found at the end of this chapter and carefully evaluate if your system's workload can benefit from having transparent hugepages enabled.

Status of the transparent hugepages in your host

To check out the current status of the transparent hugepages in your standalone PVE node, log as your mgrsys user in a shell and execute:

$ cat /sys/kernel/mm/transparent_hugepage/enabled
always [madvise] never

The highlighted value is madvise, which means that transparent hugepages are enabled but only for applications that request it specifically.

There is other parameter that hints about the usage of transparent hugepages, AnonHugePages. To see its current value, execute the following command:

$ grep AnonHuge /proc/meminfo
AnonHugePages:         0 kB

At this point, no application has made use of transparent hugepages, so the value of AnonHugePages is 0 KiB.

Disabling the transparent hugepages

To switch the status of the transparent hugepages from madvise to never, you must modify the configuration of your Debian's Grub boot system:

  1. Open a shell as mgrsys, cd to /etc/default/ and make a backup of the original grub file:

    $ cd /etc/default/
    $ sudo cp grub grub.orig
  2. Edit the grub file, modifying the GRUB_CMDLINE_LINUX="" line as follows:

    GRUB_CMDLINE_LINUX="transparent_hugepage=never"
  3. Update the grub and reboot the system:

    $ sudo update-grub
    $ sudo reboot
  4. Log again as mgrsys and check the current status of the transparent hugepages:

    $ cat /sys/kernel/mm/transparent_hugepage/enabled
    always madvise [never]

    The highlighted status should be never now, as shown in the snippet above.

Relevant system paths

Directories

  • /etc/default

Files

  • /etc/default/grub
  • /etc/default/grub.orig
  • /proc/meminfo
  • /sys/kernel/mm/transparent_hugepage/enabled

References

About transparent hugepages

About exclusive hugepages

Navigation

<< Previous (G015. Host optimization 01) | +Table Of Contents+ | Next (G017. Virtual Networking) >>