Skip to content

Latest commit

 

History

History
80 lines (52 loc) · 3.22 KB

G016 - Host optimization 02 ~ Disabling transparent hugepages.md

File metadata and controls

80 lines (52 loc) · 3.22 KB

G016 - Host optimization 02 ~ Disabling 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. It is enabled (“enabled=always”) by default in most Linux distributions.

Transparent Hugepages gives some applications a small performance improvement (~ 10% at best, 0-3% more typically), but can cause significant performance problems (to database engines for instance) or even apparent memory leaks at worst.

Status of 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 not system wide. It's a feature available only for applications that request it specifically.

There's 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'll have to 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]

Relevant system paths

Directories

  • /etc/default

Files

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

References

Navigation

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