oracle linux hugepage,Linux HugePages 配置 与 Oracle 性能关系说明

二. 配置HugePages

2.1 第一步: 设置memlock

在/etc/security/limits.conf文件中添加memlock的限制,注意该值略微小于实际物理内存的大小。 比如物理内存是64GB,可以设置为如下:

* soft memlock 60397977

* hard memlock 60397977

如果这里的值超过了SGA的需求,也没有不利的影响。

如果使用了Oracle Linux的oracle­-validated包,或者Exadata DB compute会自动配置这个参数。

2.2 第二步: 验证memlock

使用如下命令查看参数值:

$ ulimit -l

60397977

2.3 第三步:11g中禁用AMM

如果Oracle 是11g以后的版本,那么默认创建的实例会使用Automatic Memory Management (AMM)的特性,该特性与HugePage不兼容。

在设置HugePage之前需要先禁用AMM。设置初始化参数MEMORY_TARGET 和MEMORY_MAX_TARGET 为0即可。

使用AMM的情况下,所有的SGA 内存都是在/dev/shm 下分配的,因此在分配SGA时不会使用HugePage。这也是AMM 与HugePage不兼容的原因。

另外:默认情况下ASM instance 也是使用AMM的,但因为ASM 实例不需要大SGA,所以对ASM 实例使用HugePages意义不大。

如果我们要使用HugePage,那么就必须先确保没有设置MEMORY_TARGET/ MEMORY_MAX_TARGET参数。

2.4 第四步:计算vm.nr_hugepages的建议值

确保所有的数据库实例都已经启动,包括ASM 实例。使用hugepages_settings.sh 脚本获取thevm.nr_hugepages 内核参数的建议值。

$ ./hugepages_settings.sh

...

Recommended setting: vm.nr_hugepages = 1496

$

也可以根据自己的经验来计算该值。

脚本如下:

#!/bin/bash

#

#hugepages_settings.sh

#

# Linux bash scriptto compute values for the

# recommendedHugePages/HugeTLB configuration

#

# Note: This scriptdoes calculation for all shared memory

# segmentsavailable when the script is run, no matter it

# is an OracleRDBMS shared memory segment or not.

#

# This script isprovided by Doc ID 401749.1 from My Oracle Support

#http://support.oracle.com

# Welcome text

echo "

This script isprovided by Doc ID 401749.1 from My Oracle Support

(http://support.oracle.com)where it is intended to compute values for

the recommendedHugePages/HugeTLB configuration for the current shared

memory segments.Before proceeding with the execution please note following:

* For ASMinstance, it needs to configure ASMM instead of AMM.

* The'pga_aggregate_target' is outside the SGA and

youshould accommodate this while calculating SGA size.

* In case youchanges the DB SGA size,

as thenew SGA will not fit in the previous HugePages configuration,

it hadbetter disable the whole HugePages,

startthe DB with new SGA size and run the script again.

And make sure that:

* OracleDatabase instance(s) are up and running

* OracleDatabase 11g Automatic Memory Management (AMM) is not setup

(SeeDoc ID 749851.1)

* The sharedmemory segments can be listed by command:

# ipcs -m

Press Enter toproceed..."

read

# Check for thekernel version

KERN=`uname -r |awk -F. '{ printf("%d.%d\n",$1,$2); }'`

# Find out theHugePage size

HPG_SZ=`grepHugepagesize /proc/meminfo | awk '{print $2}'`

if [ -z"$HPG_SZ" ];then

echo"The hugepages may not be supported in the system where the script isbeing executed."

exit 1

fi

# Initialize thecounter

NUM_PG=0

# Cumulative numberof pages required to handle the running shared memory segments

for SEG_BYTES in`ipcs -m | cut -c44-300 | awk '{print $1}' | 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

RES_BYTES=`echo"$NUM_PG * $HPG_SZ * 1024" | bc -q`

# An SGA less than100MB does not make sense

# Bail out if thatis the case

if [ $RES_BYTES -lt100000000 ]; then

echo "***********"

echo "** ERROR **"

echo "***********"

echo "Sorry! There are not enough total of shared memory segmentsallocated for

HugePagesconfiguration. HugePages can only be used for shared memory segments

that you can listby command:

# ipcs -m

of a size that canmatch an Oracle Database SGA. Please make sure that:

* OracleDatabase instance is up and running

* OracleDatabase 11g Automatic Memory Management (AMM) is not configured"

exit 1

fi

# Finish withresults

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

# End0b1331709591d260c1c78e86d0c51c18.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
提供的源码资源涵盖了安卓应用、小程序、Python应用和Java应用等多个领域,每个领域都包含了丰富的实例和项目。这些源码都是基于各自平台的最新技术和标准编写,确保了在对应环境下能够无缝运行。同时,源码中配备了详细的注释和文档,帮助用户快速理解代码结构和实现逻辑。 适用人群: 这些源码资源特别适合大学生群体。无论你是计算机相关专业的学生,还是对其他领域编程感兴趣的学生,这些资源都能为你提供宝贵的学习和实践机会。通过学习和运行这些源码,你可以掌握各平台开发的基础知识,提升编程能力和项目实战经验。 使用场景及目标: 在学习阶段,你可以利用这些源码资源进行课程实践、课外项目或毕业设计。通过分析和运行源码,你将深入了解各平台开发的技术细节和最佳实践,逐步培养起自己的项目开发和问题解决能力。此外,在求职或创业过程中,具备跨平台开发能力的大学生将更具竞争力。 其他说明: 为了确保源码资源的可运行性和易用性,特别注意了以下几点:首先,每份源码都提供了详细的运行环境和依赖说明,确保用户能够轻松搭建起开发环境;其次,源码中的注释和文档都非常完善,方便用户快速上手和理解代码;最后,我会定期更新这些源码资源,以适应各平台技术的最新发展和市场需求。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值