本次操作是完成 centos68 hugepage的设置
oracle 11g 在 linux 下强烈建议启用hugepage,否则如果进程过多的话会导致linux 的 pagetable 过大,物理内存不够用,产生页交换,进而影响oracle的性能。
启用hugepage
在/etc/security/limits.conf 添加如下行
oracle soft memlock 60712408
oracle hard memlock 60712408
注意,这里设置的值均以kb为单位的(具体数字依据主机的内存大小)!
设置用户内存配置,有个计算规则是:
实际物理内存 > 锁定内存 >= HugePages_Total*Hugepagesize
这个dba要简单比较下
在/etc/sysctl.conf 添加如下行
vm.nr_hugepages=17000
运行oracle 的 hugepages_set.sh 脚本,给出建议值(必须在oracle启动状态下)
或者手动计算nr_hugepages的公式:
nr_hugepages>=sga(mb)/Hugepagesize(mb)
os 刷新数据
sync
echo 3 > /proc/sys/vm/drop_cache
禁用透明 hugepage
临时修改
echo “never” > /sys/kernel/mm/transparent_hugepage/enabled
echo “never” > /sys/kernel/mm/redhat_transparent_hugepage/enabled
永久修改
vi /boot/grub/grub.conf
kernel /vmlinuz-2.6.32-300.25.1.el6uek.x86_64 ro root=LABEL=/ transparent_hugepage=never
或者
vi /etc/rc.local
echo ‘never’ > /sys/kernel/mm/transparent_hugepage/enabled
echo ‘never’ > /sys/kernel/mm/transparent_hugepage/defrag
下面是mos的内容
开始
To disable Transparent HugePages boot time either one of the following 2 methods may be used:
Add the following to the kernel boot line in /etc/grub.conf (a symlink to /boot/grub/grub.conf) and reboot the server (this is the preferred method):
transparent_hugepage=never
Once modified the line will read similar to the following example:
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
OR
Add the following lines in /etc/rc.local and reboot the server (this still can be done on Redhat 7 although rc.local is being deprecated):
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
Please change the file path for RHEL kernel to /sys/kernel/mm/redhat_transparent_hugepage/ accordingly.
结束
grep AnonHugePages /proc/meminfo
确认启用hugepage
reboot
cat /proc/meminfo |grep -i huge
参考:
ALERT: Disable Transparent HugePages on SLES11, RHEL6, RHEL7, OL6, OL7, and UEK2 and above (文档 ID 1557478.1)
Oracle Linux: Shell Script to Calculate Values Recommended Linux HugePages / HugeTLB Configuration (文档 ID 401749.1)