大記憶體( Very Large Memory)和 大頁( HugePages)系列二--配置大頁,largehugepages

來源:互聯網
上載者:User

大記憶體( Very Large Memory)和 大頁( HugePages)系列二--配置大頁,largehugepages

在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 -l60397977

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 versionKERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`# Find out the HugePage sizeHPG_SZ=`grep Hugepagesize /proc/meminfo | awk {'print $2'}`# Start from 1 pages to be on the safe side and guarantee 1 free HugePageNUM_PG=1# Cumulative number of pages required to handle the running shared memory segmentsfor 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`   fidone# Finish with resultscase $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


相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.