Home >Database >Mysql Tutorial >THPTransparentHugePages相关知识与关闭

THPTransparentHugePages相关知识与关闭

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 16:12:291603browse

最近遇到个LINUX系统内存比较大,未开 HugePages,业务有变化导致ORACLE连接数剧增至上千个,PageTables达到上百G,导致内存不足系统HANG住的案例。 因此需要开启 HugePages,操作系统是OEL6以上的。LINUX的以下版本:Red Hat Enterprise Linux 6, SUSE Linux

最近遇到个LINUX系统内存比较大,未开 HugePages,业务有变化导致ORACLE连接数剧增至上千个,PageTables达到上百G,导致内存不足系统HANG住的案例。

因此需要开启 HugePages,操作系统是OEL6以上的。LINUX的以下版本:Red Hat Enterprise Linux 6, SUSE Linux Enterprise Server 11, and Oracle Linux 6 with earlier releases of Oracle Linux Unbreakable Enterprise Kernel 2 (UEK2) kernels. Transparent HugePages是默认开启的,因此在这些版本的LINUX系统中,ORACLE强烈建议开启HugePages需要关闭Transparent HugePages。

在以下版本的LINUX中Transparent HugePages默认是关闭--从内核移除的。

Transparent HugePages memory is disabled in later releases of Oracle Linux UEK2 kernels.

验证方法是:如果以下文件不存在,则是THP已经从内核中移除。

/sys/kernel/mm/transparent_hugepage or <code dir="ltr">/sys/kernel/mm/redhat_transparent_hugepage

<code dir="ltr">C.3 Disabling Transparent HugePages

<code dir="ltr">Transparent HugePages memory is enabled by default with Red Hat Enterprise Linux 6, SUSE Linux Enterprise Server 11, and Oracle Linux 6 with earlier releases of Oracle Linux Unbreakable Enterprise Kernel 2 (UEK2) kernels. <strong>Transparent HugePages memory is disabled in later releases of Oracle Linux UEK2 kernels.</strong>

<code dir="ltr">Transparent HugePages can cause memory allocation delays during runtime. To avoid performance issues, <strong>Oracle recommends that you disable Transparent HugePages on all Oracle Database servers. </strong>Oracle recommends that you instead use standard HugePages for enhanced performance.

<code dir="ltr">Transparent HugePages memory differs from standard HugePages memory because the kernel khugepaged thread allocates memory dynamically during runtime. Standard HugePages memory is pre-allocated at startup, and does not change during runtime.

<code dir="ltr">o check if Transparent HugePages memory is enabled, run one of the following commands as the <code dir="ltr">root user:

<code dir="ltr"><code dir="ltr">Red Hat Enterprise Linux kernels:

<code dir="ltr"><code dir="ltr"><code dir="ltr"># cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
</code></code></code>

<code dir="ltr"><code dir="ltr">Other kernels:

<code dir="ltr"><code dir="ltr"><code dir="ltr"># cat /sys/kernel/mm/transparent_hugepage/enabled
</code></code></code>

<code dir="ltr"><code dir="ltr">The following is a sample output that shows Transparent HugePages memory being used as the <code dir="ltr">[always] flag is enabled.

<code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr">[always] never
</code></code></code></code>

<code dir="ltr"><code dir="ltr"><code dir="ltr"><strong>Note:</strong>

If Transparent HugePages is removed from the kernel, then the /sys/kernel/mm/transparent_hugepage or <code dir="ltr">/sys/kernel/mm/redhat_transparent_hugepage files do not exist.<code dir="ltr">

<code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr">To disable Transparent HugePages, perform the following steps:

<code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr">Add the following entry to the kernel boot line in the <code dir="ltr">/etc/grub.conf file:

<code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr">transparent_hugepage=never
</code></code></code></code></code></code></code>

<code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr">For example:

<code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr">title Oracle Linux Server (2.6.32-300.25.1.el6uek.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-300.25.1.el6uek.x86_64 ro root=LABEL=/   transparent_hugepage=never
        initrd /initramfs-2.6.32-300.25.1.el6uek.x86_64.img
</code></code></code></code></code></code></code>

<code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr"><code dir="ltr">Restart the system to make the changes permanent.


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn