1

I am following this link, https://docs.mongodb.com/v3.0/tutorial/transparent-huge-pages/

I am getting the output

cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]

cat /sys/kernel/mm/transparent_hugepage/defrag
[always] madvise never

This is what i did

1)Create the following file at /etc/init.d/disable-transparent-hugepages:

case $1 in
  start)
    if [ -d /sys/kernel/mm/transparent_hugepage ]; then
      thp_path=/sys/kernel/mm/transparent_hugepage
    elif [ -d /sys/kernel/mm/redhat_transparent_hugepage ]; then
      thp_path=/sys/kernel/mm/redhat_transparent_hugepage
    else
      return 0
    fi

    echo 'never' > ${thp_path}/enabled
    echo 'never' > ${thp_path}/defrag

    unset thp_path
    ;;
esac

2) run

sudo chmod 755 /etc/init.d/disable-transparent-hugepages

3) run

sudo chkconfig --add disable-transparent-hugepages

4)run

sudo mkdir /etc/tuned/no-thp

5) Create and edit /etc/tuned/no-thp/tuned.conf so that it contains the following:

[main]
include=virtual-guest

[vm]
transparent_hugepages=never

6)run

sudo tuned-adm profile no-thp

7)

cat /sys/kernel/mm/transparent_hugepage/enabled
always madvise [never]

cat /sys/kernel/mm/transparent_hugepage/defrag
[always] madvise never

8) same result even after restart server Please help me Thank you

2
  • 2
    I don't understand why the mongodb documentation recommends to use a init script to make kernel parameters persistent. IMHO the correct way is to use /etc/sysctl.conf Jun 23, 2016 at 18:33
  • /etc/sysctl.conf isn't web-scale.
    – womble
    Jun 24, 2016 at 2:05

1 Answer 1

0

I added this in the /etc/init.d/mongod after #!/bin/bash

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

it work fine

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .