我要评分
获取效率
正确性
完整性
易理解

Tuning HugePages

Principle

Enable HugePages to enable the OS to support memory pages larger than the default value (usually 4 KB). Using HugePages can reduce the amount of system resources required to access page table entries and improve system performance. HugePages can be used for 32-bit and 64-bit system configurations. According to the kernel version and hardware architecture, the huge page sizes ranges from 2 MB to 256 MB.

The advantages of using HugePages are as follows:

  • The TLB hit ratio is increased to improve the performance.
  • Pages are locked in the memory and will not be swapped out, ensuring that shared memory such as SGA is reserved in the RAM.
  • Continuous pages are pre-allocated and cannot be used for anything else. They can only be used for System V shared memory.
  • Because of the larger page size, this part of the kernel for virtual memory has less recording work.

Procedure

  1. Run the following command to enable the transparent huge page function (enabled by default for RHEL and CentOS 7.6).

    echo always > /sys/kernel/mm/transparent_hugepage/enabled

  2. Run the following command to install libhugetlbfs.

    yum install libhugetlbfs -y

  3. Run the following command to add parameter -x LD_PRELOAD=/usr/lib64/libhugetlbfs.so:

    mpirun -x LD_PRELOAD=/usr/lib64/libhugetlbfs.so ./a.out