码迷,mamicode.com
首页 > 其他好文 > 详细

大内存( Very Large Memory)和 大页( HugePages)系列二--配置大页

时间:2014-12-09 00:36:30      阅读:238      评论:0      收藏:0      [点我收藏+]

标签:style   io   ar   color   os   使用   sp   for   strong   

在linux 平台如何配置hugepages


名词解释:

 memlock -  max locked-in-memory address space (KB)



1. 配置 /etc/security/limits.conf memlock 参数

memlock 略小于物理内存 大于SGA ,假设物理内存为64G 可以这么配置

vi /etc/security/limits.conf

*   soft   memlock    60397977
*   hard   memlock    60397977

2. 验证oracle软件 用户环境变量 memlock 设置

$ ulimit -l
60397977

3.查看hugepages 相关信息

$ grep Hugepagesize /proc/meminfo
[oracle@oracle11g-dag trace]$  grep Hugepagesize /proc/meminfo
Hugepagesize:       2048 kB


4.使用一个oracle 脚本计算HugePages/HugeTLB 设置值

#!/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


5.写入配置文件vi /etc/sysctl.conf

vm.nr_hugepages=value_displayed_in_step_4

6.重启服务器

验证配置:

 grep Huge /proc/meminfo


hugepages 使用的局限性:

。oracle 自动内存管理(AMM) memory_target 和 hugepages 不能共存;

  • If you are using VLM in a 32-bit environment, then you cannot use HugePages for the Database Buffer cache. You can use HugePages for other parts of the SGA, such as shared_poollarge_pool, and so on. Memory allocation for VLM (buffer cache) is done using shared memory file systems (ramfs/tmpfs/shmfs). Memory file systems do not reserve or use HugePages.

  • HugePages are not subject to allocation or release after system startup, unless a system administrator changes the HugePages configuration, either by modifying the number of pages available, or by modifying the pool size. If the space required is not reserved in memory during system startup, then HugePages allocation fails


大内存( Very Large Memory)和 大页( HugePages)系列二--配置大页

标签:style   io   ar   color   os   使用   sp   for   strong   

原文地址:http://blog.csdn.net/lixora/article/details/41812229

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!