Linux 11G RAC啟用HugePages與AMM的禁用

eric0435發表於2016-04-20

HugePages是整合到Linux kernel 2.6中的一個功能。啟用HugePages可以使用作業系統來支援比預設的記憶體頁(4KB)更大的記憶體頁。使用非常大的記憶體頁大小可以透過減少訪問頁表條目所需要的系統資源數量而提高系統效能。HugePages對於32位與64位系統都是有效的。HugePage的大小範圍從2MB到256MB,依賴於核心版本和硬體架構。對於Oracle資料庫,使用HugePages減少作業系統維護記憶體頁
狀態並增加Translation Lookaside Buffer(TLB)的撞擊率。

1.使用HugePages來最佳化SGA
不使用HugePages時,作業系統將保持每個記憶體頁大小為4KB,當為SGA分配記憶體頁時,作業系統核心必須對分配給SGA的每個4KB頁使用頁生命週期(髒,可用,對映到程式,等等)持續更新。

使用HugePages時,作業系統頁表(虛擬記憶體到實體記憶體的對映)很小,因為每個頁表條目指向的記憶體頁大小從2MB到256MB。同時核心有比較少的記憶體頁生命週期被監控。例如,如果64位硬體使用HugePages,並且想要對映256MB的記憶體,你可能只需要一個頁表條目(PTE)。如果不使用HugePages並且想要對映256MB記憶體,那麼必須有256*1024KB/4KB=65536個PTEs。

HugePages提供了以下優點:
透過增加TLB撞擊率來提高效能
記憶體頁被鎖定在記憶體中並且不會發生交換,對共享記憶體結構比如SGA提供了隨機訪問
連續記憶體頁預分配除了用於系統的共享記憶體比如SGA不能用於其它的目的
因為使用大的記憶體頁大小所以虛擬記憶體相關的核心有較少效能開銷

2 對Linux配置HugePages
執行以下命令來判斷核心是否支援HugePages:

[root@jyrac1 ~]# uname -r
2.6.18-164.el5

[root@jyrac1 ~]# grep Huge /proc/meminfo
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

有一些Linux預設情況下是不支援HugePages的。 對於這樣的系統使用config_hugetlbfs和config_hugetlb_page配置選項來構建Linux核心。config_hugetlbfs位於檔案系統並且當你選擇config_hugetlbfs時需要同時選擇config_hugetlb_page。

編輯/etc/security/limits.conf檔案來設定memlock。memlock設定以KB為單位,並且當啟用HugePages記憶體時,最大鎖定記憶體限制應該被設定為當前可隨機訪問記憶體的90%,當沒有啟用HugePages記憶體時,最大鎖定記憶體限制應該被設定成至少3145728KB(3GB)。例如,如果有2G可隨機訪問記憶體,並且增加以下條目來增加最大鎖定記憶體地址空間:

[root@jyrac1 ~]# vi /etc/security/limits.conf
grid soft memlock 2097152
grid hard memlock 2097152
oracle soft memlock 2097152
oracle hard memlock 2097152

也可以將memlock的值設定為比SGA的值大

以grid使用者登入,並執行ulimit -l命令來驗證新設定的memlock是否生效

[grid@jyrac1 ~]$ ulimit -l
2097152

以oracle使用者登入,並執行ulimit -l命令來驗證新設定的memlock是否生效

[oracle@jyrac1 ~]$ ulimit -l
2097152

執行以下命令來顯示Hugepagesize變數:

[oracle@jyrac1 ~]$ grep Hugepagesize /proc/meminfo
Hugepagesize:     2048 kB

完成以下過程來建立一個指令碼用來為當前共享記憶體段計算hugepages配置的建議值建立一個hugepages_settings.sh指令碼並增加以下內容:

[root@jyrac1 /]# vi hugepages_settings.sh
#!/bin/bash
#
# hugepages_settings.sh
#
# Linux bash script to compute values for the
# recommended HugePages/HugeTLB configuration
# on Oracle Linux
#
# 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.
#
# This script is provided by Doc ID 401749.1 from My Oracle Support 
# 

# Welcome text
echo "
This script is provided by Doc ID 401749.1 from My Oracle Support 
() where it is intended to compute values for 
the recommended HugePages/HugeTLB configuration for the current shared 
memory segments on Oracle Linux. Before proceeding with the execution please note following:
 * For ASM instance, it needs to configure ASMM instead of AMM.
 * The 'pga_aggregate_target' is outside the SGA and 
   you should accommodate this while calculating SGA size.
 * In case you changes the DB SGA size, 
   as the new SGA will not fit in the previous HugePages configuration, 
   it had better disable the whole HugePages, 
   start the DB with new SGA size and run the script again.
And make sure that:
 * Oracle Database instance(s) are up and running
 * Oracle Database 11g Automatic Memory Management (AMM) is not setup 
   (See Doc ID 749851.1)
 * The shared memory segments can be listed by command:
     # ipcs -m


Press Enter to proceed..."

read

# 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}'`
if [ -z "$HPG_SZ" ];then
    echo "The hugepages may not be supported in the system where the script is being executed."
    exit 1
fi

# Initialize the counter
NUM_PG=0

# Cumulative number of 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 than 100MB does not make sense
# Bail out if that is the case
if [ $RES_BYTES -lt 100000000 ]; then
    echo "***********"
    echo "** ERROR **"
    echo "***********"
    echo "Sorry! There are not enough total of shared memory segments allocated for 
HugePages configuration. HugePages can only be used for shared memory segments 
that you can list by command:

    # ipcs -m

of a size that can match an Oracle Database SGA. Please make sure that:
 * Oracle Database instance is up and running 
 * Oracle Database 11g Automatic Memory Management (AMM) is not configured"
    exit 1
fi

# Finish with results
case $KERN in
     '2.2') echo "Kernel version $KERN is not supported. Exiting." ;;
    '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" ;;
    '3.8') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
    '3.10') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
    '4.1') echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;
esac

# End

執行以下命令來改變hugepages_settings.sh指令碼的許可權

[root@jyrac1 /]# chmod +x hugepages_settings.sh

執行hugepages_settings.sh指令碼來計算hugepages配置的引數值

[root@jyrac1 /]# ./hugepages_settings.sh
This script is provided by Doc ID 401749.1 from My Oracle Support 
() where it is intended to compute values for 
the recommended HugePages/HugeTLB configuration for the current shared 
memory segments on Oracle Linux. Before proceeding with the execution please note following:
 * For ASM instance, it needs to configure ASMM instead of AMM.
 * The 'pga_aggregate_target' is outside the SGA and 
   you should accommodate this while calculating SGA size.
 * In case you changes the DB SGA size, 
   as the new SGA will not fit in the previous HugePages configuration, 
   it had better disable the whole HugePages, 
   start the DB with new SGA size and run the script again.
And make sure that:
 * Oracle Database instance(s) are up and running
 * Oracle Database 11g Automatic Memory Management (AMM) is not setup 
   (See Doc ID 749851.1)
 * The shared memory segments can be listed by command:
     # ipcs -m


Press Enter to proceed...

***********
** ERROR **
***********
Sorry! There are not enough total of shared memory segments allocated for 
HugePages configuration. HugePages can only be used for shared memory segments 
that you can list by command:

    # ipcs -m

of a size that can match an Oracle Database SGA. Please make sure that:
 * Oracle Database instance is up and running 
 * Oracle Database 11g Automatic Memory Management (AMM) is not configured

從上面的資訊可以看到需要確認Oracle例項是否正在執行,如果是Oracle 11g不能使用AMM

[root@jyrac1 ~]# ps -ef | grep pmon
grid      4116     1  0 Apr18 ?        00:00:03 asm_pmon_+ASM1
oracle    4944     1  0 Apr18 ?        00:00:03 ora_pmon_jyrac1
root     18184 29273  0 15:15 pts/1    00:00:00 grep pmon

上面資訊可以看到Oracle例項正在執行。

[grid@jyrac1 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 20 15:20:23 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Real Application Clusters and Automatic Storage Management options

SQL> set long 900
SQL> set linesize 900
SQL> show parameter instance_name

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
instance_name                        string                 +ASM1
SQL> show parameter memory

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
memory_max_target                    big integer            1076M
memory_target                        big integer            1076M


[oracle@jyrac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 20 15:21:04 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> set long 900
SQL> set linesize 900
SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      jyrac1
SQL> show parameter memory

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 2G
memory_target                        big integer 2G
shared_memory_address                integer     0

確實asm與資料庫例項都啟用了AMM,需要禁用AMM但是可以使用ASMM修改ASM例項,禁用AMM,但使用ASMM,如果是RAC所有節點都需要修改

SQL> alter system set sga_max_size=640M scope=spfile sid='*';

System altered.

SQL> alter system set sga_target=640M scope=spfile sid='*';

System altered.

SQL> alter system set pga_aggregate_target=320M scope=spfile sid='*';

System altered.

SQL>  alter system set memory_target=0 scope=spfile sid='*';

System altered.

這裡對於memory_target不能使用reset否則會出現以下錯誤:

SQL> startup
ORA-01078: failure in processing system parameters
ORA-00843: Parameter not taking MEMORY_MAX_TARGET into account
ORA-00849: SGA_TARGET 671088640 cannot be set to more than MEMORY_MAX_TARGET 0.
SQL> alter system reset memory_max_target scope=spfile sid='*';

System altered.

修改資料庫例項,禁用AMM,但使用ASMM,如果是RAC所有節點都需要修改

SQL> alter system set sga_max_size=640M scope=spfile sid='*';

System altered.

SQL> alter system set sga_target=640M scope=spfile sid='*';

System altered.

SQL> alter system set pga_aggregate_target=320M scope=spfile sid='*';

System altered.

SQL> alter system reset memory_max_target scope=spfile sid='*';

System altered.

SQL> alter system reset memory_target scope=spfile sid='*';

System altered.

重啟ASM與資料庫例項,如果是RAC所有節點都需要重啟,首先停止ASM與資料庫例項

[grid@jyrac1 ~]$ srvctl stop asm -n jyrac1 -f
[grid@jyrac1 ~]$ srvctl stop asm -n jyrac2 -f
[grid@jyrac1 ~]$ srvctl stop database -d jyrac



[grid@jyrac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRSDG.dg
               OFFLINE OFFLINE      jyrac1                                       
               OFFLINE OFFLINE      jyrac2                                       
ora.DATADG.dg
               OFFLINE OFFLINE      jyrac1                                       
               OFFLINE OFFLINE      jyrac2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.asm
               OFFLINE OFFLINE      jyrac1                   Instance Shutdown   
               OFFLINE OFFLINE      jyrac2                   Instance Shutdown   
ora.gsd
               ONLINE  OFFLINE      jyrac1                                       
               ONLINE  OFFLINE      jyrac2                                       
ora.net1.network
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.ons
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.registry.acfs
               OFFLINE OFFLINE      jyrac1                                       
               OFFLINE OFFLINE      jyrac2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jyrac2                                       
ora.cvu
      1        ONLINE  ONLINE       jyrac2                                       
ora.jyrac.db
      1        OFFLINE OFFLINE                               Instance Shutdown   
      2        OFFLINE OFFLINE                               Instance Shutdown   
ora.jyrac1.vip
      1        ONLINE  ONLINE       jyrac1                                       
ora.jyrac2.vip
      1        ONLINE  ONLINE       jyrac2                                       
ora.oc4j
      1        ONLINE  ONLINE       jyrac2                                       
ora.scan1.vip
      1        ONLINE  ONLINE       jyrac2             

啟動ASM與資料庫例項

grid@jyrac1 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 20 17:48:32 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ASM instance started

Total System Global Area  669581312 bytes
Fixed Size                  1366724 bytes
Variable Size             643048764 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled

SQL> show parameter instance_name

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
instance_name                        string                 +ASM2
SQL> show parameter memory

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
memory_max_target                    big integer            0
memory_target                        big integer            0
SQL> show parameter sga

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
lock_sga                             boolean                FALSE
sga_max_size                         big integer            640M
sga_target                           big integer            640M

grid@jyrac2 ~]$ sqlplus / as sysasm

SQL*Plus: Release 11.2.0.4.0 Production on Wed Apr 20 17:48:32 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ASM instance started

Total System Global Area  669581312 bytes
Fixed Size                  1366724 bytes
Variable Size             643048764 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled

SQL> show parameter instance_name

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
instance_name                        string                 +ASM2
SQL> show parameter memory

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
memory_max_target                    big integer            0
memory_target                        big integer            0
SQL> show parameter sga

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
lock_sga                             boolean                FALSE
sga_max_size                         big integer            640M
sga_target                           big integer            640M

[grid@jyrac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRSDG.dg
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.DATADG.dg
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.asm
               ONLINE  ONLINE       jyrac1                   Started             
               ONLINE  ONLINE       jyrac2                   Started             
ora.gsd
               ONLINE  OFFLINE      jyrac1                                       
               ONLINE  OFFLINE      jyrac2                                       
ora.net1.network
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.ons
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.registry.acfs
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jyrac1                                       
ora.cvu
      1        ONLINE  ONLINE       jyrac1                                       
ora.jyrac.db
      1        OFFLINE OFFLINE                               Instance Shutdown   
      2        OFFLINE OFFLINE                               Instance Shutdown   
ora.jyrac1.vip
      1        ONLINE  ONLINE       jyrac1                                       
ora.jyrac2.vip
      1        ONLINE  ONLINE       jyrac2                                       
ora.oc4j
      1        ONLINE  ONLINE       jyrac1                                       
ora.scan1.vip
      1        ONLINE  ONLINE       jyrac1                 

從上面的資訊可以看到asm例項已經啟動了並且禁用了AMM

[grid@jyrac1 ~]$ srvctl start database -d jyrac
[grid@jyrac1 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRSDG.dg
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.DATADG.dg
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.asm
               ONLINE  ONLINE       jyrac1                   Started             
               ONLINE  ONLINE       jyrac2                   Started             
ora.gsd
               ONLINE  OFFLINE      jyrac1                                       
               ONLINE  OFFLINE      jyrac2                                       
ora.net1.network
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.ons
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
ora.registry.acfs
               ONLINE  ONLINE       jyrac1                                       
               ONLINE  ONLINE       jyrac2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jyrac1                                       
ora.cvu
      1        ONLINE  ONLINE       jyrac1                                       
ora.jyrac.db
      1        ONLINE  ONLINE       jyrac1                   Open                
      2        ONLINE  ONLINE       jyrac2                   Open                
ora.jyrac1.vip
      1        ONLINE  ONLINE       jyrac1                                       
ora.jyrac2.vip
      1        ONLINE  ONLINE       jyrac2                                       
ora.oc4j
      1        ONLINE  ONLINE       jyrac1                                       
ora.scan1.vip
      1        ONLINE  ONLINE       jyrac1   

SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      jyrac1
SQL> show parameter memory

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 0
memory_target                        big integer 0
shared_memory_address                integer     0
SQL> show parameter sga

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 640M
sga_target                           big integer 640M


SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      jyrac2
SQL> show parameter memory

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
hi_shared_memory_address             integer     0
memory_max_target                    big integer 0
memory_target                        big integer 0
shared_memory_address                integer     0
SQL> show parameter sga

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
lock_sga                             boolean     FALSE
pre_page_sga                         boolean     FALSE
sga_max_size                         big integer 640M
sga_target                           big integer 640M                   

資料庫也已經成功啟動並且禁用了AMM

再次執行hugepages_settings.sh指令碼計算HugePages的大小

[root@jyrac1 /]# ./hugepages_settings.sh
Recommended setting: vm.nr_hugepages = 649

編輯/etc/sysctl.conf檔案增加引數vm.nr_hugepages = 649,並執行sysctl -p命令使用修改立即生效,但oracle例項並沒有使用HugePages從HugePages_Total與HugePages_Free相等可以判斷出來。

[root@jyrac1 /]# vi /etc/sysctl.conf
vm.nr_hugepages = 649
[root@jyrac1 /]# sysctl -p

[root@jyrac1 /]# grep Huge /proc/meminfo
HugePages_Total:   649
HugePages_Free:    649
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

重啟例項

SQL> startup
ASM instance started

Total System Global Area  669581312 bytes
Fixed Size                  1366724 bytes
Variable Size             643048764 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
ASM diskgroups volume enabled

檢視asm例項的alert_+ASM1.log可以看到如下資訊:

Starting ORACLE instance (normal)
************************ Large Pages Information *******************
Per process system memlock (soft) limit = 2048 MB
 
Total Shared Global Region in Large Pages = 642 MB (100%)
 
Large Pages used by this instance: 321 (642 MB)
Large Pages unused system wide = 328 (656 MB)
Large Pages configured system wide = 649 (1298 MB)
Large Page size = 2048 KB
SQL> startup
ORACLE instance started.

Total System Global Area  669581312 bytes
Fixed Size                  1366724 bytes
Variable Size             243270972 bytes
Database Buffers          419430400 bytes
Redo Buffers                5513216 bytes
Database mounted.
Database opened.

檢視例項jyrac1的alert_jyrac1.log可以看到如下資訊:

Starting ORACLE instance (normal)
************************ Large Pages Information *******************
Per process system memlock (soft) limit = 2048 MB
 
Total Shared Global Region in Large Pages = 642 MB (100%)
 
Large Pages used by this instance: 321 (642 MB)
Large Pages unused system wide = 7 (14 MB)
Large Pages configured system wide = 649 (1298 MB)
Large Page size = 2048 KB


[root@jyrac1 /]# grep Huge /proc/meminfo
HugePages_Total:   649
HugePages_Free:    239
HugePages_Rsvd:    232
Hugepagesize:     2048 kB

從上面的資訊可以看到已經使用了Hugepages

3.HugePages的限制
HugePages有以下限制:
a.對於Oracle 11g及以上版本資料庫例項必須對memory_target與memory_max_target引數執行alter system reset命令,但對於ASM例項,對於memory_target引數只能設定為0。
b.AMM與HugePages是不相容的,當使用AMM,整個SGA記憶體透過在/dev/shm建立檔案來進行記憶體的分配,當使用AMM分配SGA時,HugePages不會被保留。
c.如果在32位系統中使用VLM,那麼對資料庫buffer cache不能使用HugePages。但對於SGA中的其它元件比如shared_pool,
large_pool等等可以使用HugePages。對於VLM(buffer cache)分配記憶體是透過使用共享記憶體檔案系統(ramfs/tmpfs/shmfs)來實現的。
d.HugePgaes在系統啟動後不受分配或釋放,除非系統管理員透過修改可用頁數或改變池大小來改變HugePages的配置。如果在系統啟動時記憶體中沒有保留所需要記憶體空間,那麼HugePages會分配失敗。
e.確保HugePages配置合理,如果記憶體耗盡,應用將不能使用HugePages。
f.如果當例項啟動用沒有足夠的HugePages並且引數use_large_pages設定為only,那麼Oracle資料庫將會啟動失敗並向alert.log中記錄相關資訊。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26015009/viewspace-2084959/,如需轉載,請註明出處,否則將追究法律責任。

相關文章