Search This Blog

2012-07-01

Oracle: Advance Configuration of Linux HugePages

Product: Oracle RDBMS
OS: Linux in Intel x86 64-bit
Version: Any version supports hugepages

Although Oracle and many others document about Linux kernel hugepages, but none talk about other implication of hugepages, which I am quite upset about going through cycle of argument with DBA.

Guideline summary:
1. This setting applies to any Linux distribution
2. kernel value hugepages is in number of memory block in 2 MB size
3. Kernel parameter file, and value

Kernel setting file: /etc/sysctl.conf
Value: vm.nr_hugepages =

4. It will stop Linux from paging Oracle process memory to swap file
5. 60 GB of target Oracle SGA will need 30,720 huge pages (60 GB / 2 MB = 30,720 huge page)
6. Very Oracle shadow process (1 process spawn for every Oracle client connection, except using Oracle Shared Server)
7. Number of private page table per Oracle shadow process with hugepage = 60 GB / 2 MB = 30,720 pages
8. Page Table Entry (PTE) size per Oracle shadow process = 30,720 * 8 byte = 240 KB
9. If there are 300 Oracle client connections (like CRM, SAP, Tomcat with JDBC), with every Oracle shadow process need 240 KB of overhead = 240 KB * 300 = 70 MB

Most DBA use estimate on target Oracle SGA to derive, following example show the most accurate method to calculate the kernel hugepage value

1. Set Oracle SGA without setting huge page
2. Startup Oracle database. If multiple database, then start up all databases
3. Type: ipcs -m | grep oracle (where this is the UNIX user who start up Oracle process). Following shown 2 Oracle databases each allocated about 20 GB memory

# ipcs -m | grep oracle
0x38671d2c 3997702    oracle    660        21476933632 30

0x41271ab1 3997702    oracle    660        21476933632 30


4. If there is another Oracle process using different Oracle UNIX user, then grep with that username, e.g. oraias, orasap, oraweb

# ipcs -m | grep -e oraias -e orasap -e oraweb

5. Value 21476933632 byte is the actual memory allocated to Oracle database. Use calculator to sum up all the memory used


6. To activate huge page immediately, run this command as root: sysctl -w vm.nr_hugepages=
7. Started up database, and run following as normal user to confirm huge page is used:


grep HugePages /proc/meminfo


Note:
File: /etc/security/limits.conf


Following lines are assumed has been configured as per Oracle document



oracle          soft    memlock        unlimited
oracle          hard    memlock        unlimited



If there are other Orale UNIX user who will start the database, there there will be additional lines configure



Please use following PayPal donate if this post helped

No comments: