Configuring Hugepage in Linux can improve Oracle's performance and reduce page swapping for Oracle SGA, similar to Lagepage in Aix.
Why use large pages?
The default block size for Linux memory is 4K
If the SGA is: 128G
Select 128*1024*1024/4 from dual;33554432 (more than 30 million),
Select 128*1024/2 from dual; 65,536 x
Each memory page has a page table entry (about 10 bytes) that records the page's status, location
The default block size is 4K--page Table size: 320M.
The page table is only occupied when the large page is under 2M. 625M
In Linux, each process page table is independent and has its own page table.
If there are 1000 processes: 1000*320m is approximately 320G.
While 1000 processes use a large page: 1000*0.625=625m
A large page was set up but not used by Oracle for only two reasons:
(1), sga_max_size more than a large page
(2), no memory lock set
Memory: Is the stage where the process is active, and the Oracle database automatically searches for large pages when it is startup.
If so, allocate the SGA in a large page.
If not, the default chunk size is used to start normally.
#############
To set a large page step:
1. Check your system's current large page usage:
[Email protected] ~]$ cat/proc/meminfo |grep Huge
hugepages_total:0
hugepages_free:0
hugepages_rsvd:0
hugepages_surp:0
Hugepagesize:2048 KB--Large page size is 2M
[email protected] bys3>show parameter Sga_max--view database SGA Size--My lab machine
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Sga_max_size Big Integer 216M
2. Set the number of large pages
--Here are 200 *2M=400M,SGA max 216M, large pages of memory larger than the SGA size to be used by Oracle, so I set 200.
Vi/etc/sysctl.conf
Add a line inside:
vm.nr_hugepages=200
After saving, execute:
Sysctl-p
View:--if hugepages_free: Less than 200, perform several more sysctl-p
[Email protected] ~]# cat/proc/meminfo |grep Huge
hugepages_total:200
hugepages_free:200
hugepages_rsvd:0
hugepages_surp:0
hugepagesize:2048 KB
3. You also need to set the memory lock:--Memlock number is greater than the number of large pages--set to-1, no limit.
Vi/etc/security/limits.conf
Oracle Soft Memlock-1
Oracle Hard Memlock-1
[Email protected] ~]# ulimit-l
3500000-----This number is limited to the number of large pages, sufficient.
4. Restart the database, the large page has been used by Oracle.
[Email protected] bys3>shutdown immediate;
[Email protected] Bys3>startup
execute continuously during restart of the database; Cat/proc/meminfo |grep Huge, can see Hugepages_free: The number is declining, indicating that the large page is being used.
[Email protected] ~]# cat/proc/meminfo |grep Huge
hugepages_total:200
Hugepages_free:101
Hugepages_rsvd:10
hugepages_surp:0
hugepagesize:2048 KB
Set large page--hugepage for Oracle database under Linux