在RHEL3上配置大内存的时候需要设置 HugeTLB,这里解释一种简单的方法来找到合理的推荐值:
首先建立一个hugepages_settings.sh的shell文件,文件的内容如下:
#!/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
然后执行这个shell,会得到一个相应的结果,如:
$ ./hugepages_settings.sh
Recommended setting: vm.nr_hugepages = 67
再实现sysctl -w vm.hugetlb_pool 命令设置核心参数(RHEL5里好像没这个参数了),
之后用grep Huge /proc/meminfo命令检查HugePages是否被激活,如果装了数据库,重启一下看看meminfo有没什么变化。
如果没有生效可能需要重启一下系统了。
阅读(2403) | 评论(0) | 转发(0) |