linux系统禁用透明大页

  Oracle 安装时官方建议关闭Linux的透明大页,防止内存延迟分配导致的性能问题 https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#LADBI1519
  MOS:ID 1557478.1
   Because Transparent HugePages are known to cause unexpected node reboots and performance problems with RAC, Oracle strongly advises to disable the use of Transparent HugePages. In addition, Transparent Hugepages may cause problems even in a single-instance database environment with unexpected performance problems or delays. As such, Oracle recommends disabling Transparent HugePages on all Database servers running Oracle.

1.查看透明大页是否启用

   RHEL6:

# cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
cat /sys/kernel/mm/redhat_transparent_hugepage/enabled
[always] madvise never
   RHEL7:
# cat /sys/kernel/mm/transparent_hugepage/enabled
 cat /sys/kernel/mm/transparent_hugepage/enabled
[always] madvise never

2.禁用透明大页

RHEL 6:
(1).编辑 /etc/grub.conf 文件,在kernel 那一行后面追加 transparent_hugepage=never
vi /etc/grub.conf 
例如:
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Red Hat Enterprise Linux 6 (2.6.32-642.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-642.el6.x86_64 ro root=/dev/mapper/rootvg-lvroot rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_LVM_LV=rootvg/lvswap rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_LVM_LV=rootvg/lvroot rd_NO_DM rhgb quiet transparent_hugepage=never
initrd /initramfs-2.6.32-642.el6.x86_64.img
(2).重启系统生效。

RHEL 7:
(1).编辑/etc/sysconfig/grub 文件,在 GRUB_CMDLINE_LINUX 那一行后面追加 transparent_hugepage=never
例如:
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=rootvg/root rd.lvm.lv=rootvg/swap rhgb quiet transparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"
(2).再使用 grub2-mkconfig 生成grub.cfg配置文件。
# grub2-mkconfig -o /boot/grub2/grub.cfg
(3).重启系统使配置生效。

Related Posts