CentOS7 disables the implementation of transparent Huge pages _docker

Source: Internet
Author: User

CentOS7 Disable Transparent Huge Pages

Transparent Huge Pages (THP) has been introduced since the CENTOS6 version, and this feature is enabled by default, starting with the CentOS7 version. Although THP is intended to improve memory performance, some database vendors recommend shutting down THP (such as Oracle, MARIADB, MONGODB, etc.) directly, which may cause performance degradation.

First check the enabled status of the THP:

[Root@localhost ~]# Cat/sys/kernel/mm/transparent_hugepage/defrag
[always] madvise never
[root@localhost ~] # cat/sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never

This state is indicated to be enabled.

At this time we can certainly modify the above two files individually to disable THP, but if you want to make it permanent, take the following steps.

Edit Rc.local File:

[Root@localhost ~]# vim/etc/rc.d/rc.local

Add the following:

If Test-f/sys/kernel/mm/transparent_hugepage/enabled; Then
echo never >/sys/kernel/mm/transparent_hugepage/enabled
fi
if Test-f/sys/kernel/mm/ Transparent_hugepage/defrag; Then
echo never >/sys/kernel/mm/transparent_hugepage/defrag
fi

Save exit, and then give rc.local file execution permissions:

[Root@localhost ~]# chmod +x/etc/rc.d/rc.local

Finally reboot the system, later check THP should be disabled

[Root@localhost ~]# cat/sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]
[ Root@localhost ~]# Cat/sys/kernel/mm/transparent_hugepage/defrag 
always madvise [never]

Thank you for reading, I hope to help you, thank you for your support for this site!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.