All Products
Search
Document Center

:How to adjust Huge Pages on a Linux instance

Last Updated:Jan 27, 2026

Huge Pages improve memory access speed by using memory pages larger than the standard 4 KB size, typically 2 MB. These larger pages reduce Translation Lookaside Buffer (TLB) misses during memory address translation. However, allocating too many Huge Pages reduces the regular memory the Operating System can dynamically allocate. This can cause applications or system services that do not use Huge Pages to perform poorly or fail due to insufficient memory. If the Huge Pages setting for an instance is too high, this can cause the instance to become unreachable.

Procedure

  1. Connect to the Linux Elastic Compute Service (ECS) instance using Virtual Network Computing (VNC).

    For more information, see Connect to an instance using VNC.

  2. To back up the /etc/sysctl.conf file, run the following command.

    cp /etc/sysctl.conf /etc/sysctl.conf_bak
  3. To edit the /etc/sysctl.conf file, run the following command.

    sudo vim /etc/sysctl.conf
  4. Locate the vm.nr_hugepages parameter and reduce its value to a reasonable level.You can calculate the required number of Huge Pages based on your application's memory requirements and the total system memory.Required number of Huge Pages = Memory required by the application / Size of one Huge Page. In Linux, the default Huge Page size is typically 2 MB. For example, if an application requires 16 GB of Huge Pages memory and the Huge Page size is 2 MB, the required number of pages is 16 GB / 2 MB = 8192. Modify the parameter as follows.

    vm.nr_hugepages = 8,192
  5. To apply the configuration, run the following command.

    sudo sysctl -p
  6. Verify the change by checking the /proc/meminfo file.

    cat /proc/meminfo

Reference

Alibaba Cloud Linux uses Transparent Huge Pages (THP) and Hugetext to improve system performance. For more information, see Hugetext.