Configuring Hugepage in Linux can improve Oracle performance and reduce the page exchange of Oracle SGA, similar to the Lagepage in Aix.
Why use a large page?
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 A
Each page of memory, there is a page table entry (approximately 10 bytes), record page status, location
The default block size is 4K-page table size: 320M.
When 2M is on a large page, the page table occupies only. 625M
In Linux, each process page table is independent and has its own page table.
If there are 1000 processes: 1000*320m is about 320G.
and 1000 processes use a large page: 1000*0.625=625m
A large page was set, but was not used by Oracle for only two reasons:
(1), sga_max_size more than the big page
(2), no memory lock set
Memory: Is the stage where the process is active, and the Oracle database automatically looks for a large page setting when it is startup.
If so, distribute the SGA in the large page.
If not, the default block size is normally used to start.
#############
To set a large page step:
1. View the current large page usage of the system:
[Oracle@bys3 ~]$ 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
bys@ bys3>show Parameter Sga_max--view database SGA Size--my lab machine.
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
This column more highlights: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/
Sga_max_size Big Integer 216M
2. Set the number of large pages
--Here are 200 *2M=400M,SGA max 216M, large page memory larger than the SGA size to be used by Oracle, so I set 200.
Vi/etc/sysctl.conf
Add one line to the inside:
vm.nr_hugepages=200
Execute after Save:
Sysctl-p
View:--if hugepages_free: Less than 200, execute several times sysctl-p
[Root@bys3 ~]# cat/proc/meminfo |grep Huge
hugepages_total:200
hugepages_free:200
hugepages_rsvd:0
hugepages_surp:0
hugepagesize:2048 KB
3. Also need to set the memory Lock:--The number of memlock is larger than the number of large pages--set to 1, unlimited.
Vi/etc/security/limits.conf
Oracle Soft Memlock-1
Oracle Hard Memlock-1
[Root@bys3 ~]# Ulimit-l
3500000-----This number is for the limit of the number of large pages, enough to use.
4. Restart the database, the big page has been used by Oracle.
sys@ Bys3>shutdown Immediate;
sys@ Bys3>startup
Continuous execution during restart of the database; Cat/proc/meminfo |grep Huge, you can see Hugepages_free: The number of pages is decreasing, indicating that the large page is being used.
[Root@bys3 ~]# cat/proc/meminfo |grep Huge
hugepages_total:200
Hugepages_free:101
Hugepages_rsvd:10
hugepages_surp:0
hugepagesize:2048 KB