If you run a Oracle Database on a Linux Server with more than 16 GB physical memory and your System Global Area (SGA) is greater than 8 GB, you should configure HugePages. For large SGA sizes, HugePages can give substantial benefits in virtual memory management. Without HugePages, the memory of the SGA is divided into 4K pages, which have to be managed by the Linux kernel. Using HugePages, the page size is increased to 2MB

1. Check Physical Memory
 #grep MemTotal /proc/meminfo
MemTotal: 132151496 kB

# grep PageTables /proc/meminfo
PageTables: 1244880 kB
2. Check Database Parameter
SQL> select value from v$parameter where name = 'memory_target';
VALUE
---------------------------
0

SQL> select value/1024 from v$parameter where name = 'sga_target';

VALUE
---------------------------
41943040

SQL> select value from v$parameter where name = 'use_large_pages';

VALUE
---------------------------
TRUE
3. Check Hugepagesize
#grep Hugepagesize /proc/meminfo

Hugepagesize:       2048 kB
4. Calculate Hugepages

For the calculation of the number of hugepages there is a easy way:

SGA / Hugepagesize = Number Hugepages

41943040 / 2048 = 20480

If you run more than one database on your server, you should include the SGA of all of your instances into the calculation:

( SGA 1. Instance + SGA 2. Instance + … etc. ) / Hugepagesize = Number Hugepages

Recommended setting: vm.nr_hugepages = 20480
5. Change Server Configuration
#vi /etc/sysctl.conf

vm.nr_hugepages=20480

The next parameter is hard and soft memlock in /etc/security/limits.conf for our oracle user. This value should be smaller than our available memory but minor to our SGA

Number Hugepages * Hugepagesize = minimum Memlock

20480 * 2048 = 41943040

vi /etc/security/limits.conf

oracle               soft    memlock 41943040
oracle               hard    memlock 41943040
6. Server Reboot
#shutdown -r now
7. Check Configuration
Memlock
#ulimit -l
41943040
HugePages
#grep Huge /proc/meminfo

AnonHugePages:    538624 kB
HugePages_Total:    20480
HugePages_Free:     12292
HugePages_Rsvd:      8188
HugePages_Surp:        0
Hugepagesize:       2048 kB

Force Oracle to use HugePages

ALTER SYSTEM SET use_large_pages=only SCOPE=SPFILE;
SHUTDOWN IMMEDIATE;
STARTUP;

Source : Click Here

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.