@@ -4,62 +4,66 @@ Disable Transparent Huge Pages (THP)
44
55.. default-domain:: mongodb
66
7- Transparent Huge Pages (THP) is a Linux memory management kernel
8- module used to reduce the overhead of Translation Lookaside Buffer
9- (TLB) lookups on machines with large amounts of memory, and therefore
10- a large number of memory pages. In effect, it presents system memory
11- as a smaller number of much larger pages rather than as a larger
12- number of 4096-byte pages.
7+ Transparent Huge Pages (THP) is a Linux memory management system
8+ that reduces the overhead of Translation Lookaside Buffer (TLB) lookups on
9+ machines with large amounts of memory by using larger memory pages.
1310
14- However, THP is known to perform poorly under database workloads ,
15- which tend to have sparse rather than contiguous memory access
16- patterns. You must disable THP on Linux machines used to run MongoDB
17- instances to ensure best performance .
11+ However, database workloads often perform poorly with THP ,
12+ because they tend to have sparse rather than contiguous memory access
13+ patterns. You should disable THP on Linux machines to ensure best performance
14+ with MongoDB .
1815
19- There are three ways to disable Transparent Huge Pages on Linux.
16+ Init Script
17+ -----------
2018
21- In Boot-Time Configuration (Preferred)
22- --------------------------------------
19+ .. include:: /includes/steps/disable-thp-in-initd.rst
2320
24- .. include:: /includes/steps/disable-thp-in-grub.rst
21+ Using ``tuned`` and ``ktune``
22+ -----------------------------
2523
26- Using ``tuned`` and ``ktune`` (Necessary if you use ``tuned``)
27- --------------------------------------------------------------
24+ .. important::
2825
29- ``tuned`` and ``ktune`` are dynamic kernel tuning tools that act in
30- accordance with policies set by the system administrator. One of the
31- settings available to ``tuned`` and ``ktune`` is whether or not to use
32- THP.
26+ If installed, you must configure ``tuned`` and ``ktune`` to prevent them from
27+ re-enabling THP.
3328
34- To disable transparent hugepages, you need to edit or create a new
35- profile that sets THP to ``never`` .
29+ ``tuned`` and ``ktune`` are dynamic kernel tuning tools available on Red Hat
30+ and CentOS that can disable transparent huge pages .
3631
37- .. include:: /includes/steps/disable-thp-in-ktune.rst
32+ To disable transparent huge pages in ``tuned`` or ``ktune``, you need to edit or
33+ create a new profile that sets THP to ``never``.
3834
39- In ``/etc/rc.local`` (Alternate)
40- --------------------------------
35+ Red Hat/CentOS 6
36+ ~~~~~~~~~~~~~~~~
4137
42- .. include:: /includes/steps/disable-thp-in-rc.local.rst
38+ .. include:: /includes/steps/disable-thp-in-tuned-rhel-6.rst
39+
40+ Red Hat/CentOS 7
41+ ~~~~~~~~~~~~~~~~
42+
43+ .. include:: /includes/steps/disable-thp-in-tuned-rhel-7.rst
44+
45+ .. _test-thp-changes:
4346
4447Test Your Changes
4548-----------------
4649
47- Whichever of the three methods you use, you can check the status of THP support by issuing the command :
50+ You can check the status of THP support by issuing the following commands :
4851
4952.. code:: sh
5053
5154 cat /sys/kernel/mm/transparent_hugepage/enabled
55+ cat /sys/kernel/mm/transparent_hugepage/defrag
5256
53- or
57+ On Red Hat Enterprise Linux, CentOS, and potentially other Red
58+ Hat-based derivatives, you may instead need to use the following:
5459
5560.. code:: sh
5661
5762 cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
63+ cat /sys/kernel/mm/redhat_transparent_hugepage/defrag
5864
59- on Red Hat Enterprise Linux, CentOS, and potentially other Red
60- Hat-based derivatives.
6165
62- Correct output resembles:
66+ For both files, the correct output resembles:
6367
6468.. code:: sh
6569
0 commit comments