windows和linnux 平台如何启用 Large page?

Oracle database在10gR1之后开始支持Large page。我们知道操作系统默认的页面大小为4k。如果内存空间比较大,则需要进行频繁的页分配和管理寻址动作,管理这些内存的消耗就比较大。启用大页后,HugePage会使用2M大小的页面,能减少CPU和内存管理方面的开销,进而提升性能。建议OS内存超过16G时,启用huagepage。

注意:大页只对SGA组件起作用,对PGA、UGA无效。如果启用大页,无需设置pre_page_sga,lock_sga(因为使用hugePage管理的内存不能被Swap)。如果使用了HugePage,11g/12c新特性AMM(Automatic Memory Management)就不能使用了,但是ASMM(Automatic Shared Memory Management)可以继续使用。

如何在Windows上启用大页
A.找到下面的选项
10g:HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb10g_home1

11g:HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraDb11g_home1


B.New->String Value
ORA_LPENABLE=1 对所有实例启用大页

ORA_<ORACLE_SID>_LPENABLE=1 只对特定的实例启用大页


C.查看alert日志,看大页是否启用
Starting ORACLE instance (normal)
Large page enabled         : 1
Large page size            : 2097152
Large page request size    : 33554432

如何在Linux上启用大页
1.Edit the memlock setting in the /etc/security/limits.conf file. The memlock setting is specified in KB and set slightly lesser than the installed RAM. For example, if you have 64GB RAM installed, add the following entries to increase the max locked memory limit:

*   soft   memlock    60397977
*   hard   memlock    60397977

2.Login as the oracle user again and run the ulimit -l command to verify the new memlock setting:
$ ulimit -l
60397977

3.Run the following command to display the value of Hugepagesize variable:
$ grep Hugepagesize /proc/meminfo

4.Complete the following procedure to create a script that computes recommended values for hugepages configuration for the current shared memory segments:
  a.Create a text file named hugepages_settings.sh
  b.Add the following content in the file:

    #!/bin/bash
    #
    # hugepages_settings.sh
    #
    # Linux bash script to compute values for the
    # recommended HugePages/HugeTLB configuration
    #
    # Note: This script does calculation for all shared memory
    # segments available when the script is run, no matter it
    # is an Oracle RDBMS shared memory segment or not.
    # Check for the kernel version
    KERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`
    # Find out the HugePage size
    HPG_SZ=`grep Hugepagesize /proc/meminfo | awk {'print $2'}`
    # Start from 1 pages to be on the safe side and guarantee 1 free HugePage
    NUM_PG=1
    # Cumulative number of pages required to handle the running shared memory segments
    for SEG_BYTES in `ipcs -m | awk {'print $5'} | grep "[0-9][0-9]*"`
    do
       MIN_PG=`echo "$SEG_BYTES/($HPG_SZ*1024)" | bc -q`
       if [ $MIN_PG -gt 0 ]; then
          NUM_PG=`echo "$NUM_PG+$MIN_PG+1" | bc -q`
       fi
    done
    # Finish with results
    case $KERN in
       '2.4') HUGETLB_POOL=`echo "$NUM_PG*$HPG_SZ/1024" | bc -q`;
              echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL" ;;
       '2.6') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
        *) echo "Unrecognized kernel version $KERN. Exiting." ;;
    esac
    # End
  
  c.Run the following command to change the permission of the file:
     $ chmod +x hugepages_settings.sh
5.Run the hugepages_settings.sh script to compute the values for hugepages configuration:
  $ ./hugepages_settings.sh
6.Set the following kernel parameter:
  # sysctl -w vm.nr_hugepages=value_displayed_in_step_5
7.To make the value of the parameter available for every time you restart the computer, edit the /etc/sysctl.conf file and add the following entry:
  vm.nr_hugepages=value_displayed_in_step_5
8.Restart the server.
  $ grep Huge /proc/meminfo

Reference
http://docs.oracle.com/cd/E11882_01/win.112/e10845/tuning.htm#NTQRF090

http://docs.oracle.com/cd/E11882_01/server.112/e10839/appi_vlm.htm#UNXAR396


摘自:
http://www.ohsdba.cn/index.php?m=Article&a=show&id=198

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25462274/viewspace-2131684/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/25462274/viewspace-2131684/

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值