Friday, March 12, 2010

Configuring Hugepages For Oracle on Linux

Implemented following Configuration Changes.

1)SGA_MAX_SIZE=40G

2)SGA_TARGET = 40G

3)PGA_ AGGRIGATE_SIZE=15G



Step 1: Change kernel parameter : Kernel.shmmax (/etc/sysctl.conf)

Kernel.shmmax should be equivalent to SGA_TARGET + PGA_AGGRIGATE_SIZE + 1GB ( for other proces)


Example:

SGA_TARGET + PGA_AGGRIGATGE_SIZE + 1

40G + 15 + 1G (for other process) = 56G / 60129542144


kernel.shmmax = 68719476736 (This value did not change as per the calculated minimum original considerations, as the current value is already a high value by default )


Step 2: Change kernel parameters: Kernel.shmall (/etc/sysctl.conf )

Kernel.shmall should be set to the shmmax values divided by the page size

PAGE SIZE 4k (The standard pagesize on Linux x86_64 is 4096, or 4k)

60129542144 / 4096 = 14680064

Kernel.shmall = 14680064


kernel.shmall = 4294967296 (This value did not change as per the calculated minimum original considerations, as the current value is already a high value by default )


Step 3 : Add kernel parameter for huge page

vm.nr_hugepages is to set to (/etc/sysctl.conf )
60129542144/(2048 * 1024) = 28672
vm.nr_hugepages = 28672



Step 4: Oracle soft memlock and oracle hard memlock should be set to slightly less than the total memory on the server, If memory is 64G. Units are kbytes, so the number is 56000000. This is the total amount of memory Oracle is allowed to lock.

/etc/security/limits.conf

oracle soft memlock 56000000

oracle hard memlock 56000000



Step 5: Following Database parameters configured with below values

SGA_TARGET = 40G

SGA_MAX_SIZE=40G

PGA_AGGRIGATE_SIZE= 15G

All other memory parameter should be disable .

USE_LARGE_PAGES=only

MEMORY_MAX_TARGET=0

MEMORY_TARGET=0



Step 6: In order to verify that hugepages are being used, run this command

[mddsuwldb01:mddprod:/home/oracle:] cat /proc/meminfo
grep Huge

HugePages_Total: 28672

HugePages_Free: XXXX

HugePages_Rsvd: XXXX

Hugepagesize: 2048 kB