Rate This Document
Findability
Accuracy
Completeness
Readability

Tuning the OS

Upgrading GCC and glibc (CentOS)

This section applies only to CentOS 7.6.

In CentOS 7.6, the default GCC version is 4.85 and glibc version is 2.17. Software compilation requires certain GCC and glibc versions. Upgrading the GCC and glibc versions can improve the performance of some programs.

Table 1 describes the recommended GCC and glibc versions in the VM OS.

Table 1 GCC and glibc versions

Compiler

Version

How to Obtain

GCC

7.3.0

https://ftp.gnu.org/gnu/gcc/

glibc

2.27

https://ftp.gnu.org/gnu/libc/

Disabling Transparent Huge Pages

The transparent huge page (THP) function can reduce the complexity of using large pages. Currently, THP has been tested and optimized in various systems, configurations, programs, and loads to improve the performance of most system configurations. In scenarios where the STREAM tool is used to test memory bandwidth or memory access-intensive services, disabling transparent huge pages can effectively improve performance.

  • If the page table size in the VM OS is 64 KB, disable transparent huge pages.
  • If the page table size is 4 KB, you do not need to disable transparent huge pages.
  1. Query the THP configuration.
    1
    2
    cat /sys/kernel/mm/transparent_hugepage/enabled
    cat /sys/kernel/mm/transparent_hugepage/defrag
    

    If [always] is displayed in the command output, THP is enabled. If [never] is displayed, THP is disabled. If [madvise] is displayed, THP is enabled only for the virtual memory area (VMA) specified by MADV_HUGEPAGE.

  2. Check the value of AnonHugePages in the meminfo file in the /proc directory.
    1
    cat /proc/meminfo | grep -i huge
    

    If the value is not 0, THP has taken effect. See the following figure.

  3. Disable THP.
    1
    echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled
    
  4. Optional: To enable transparent huge pages, run the following command:
    1
    echo 'always' > /sys/kernel/mm/transparent_hugepage/enabled