Set a big page for ORACLE databases in LINUX -- hugepage

Source: Internet
Author: User

Configuring hugepage in Linux can improve oracle performance and reduce the page switching of oracle sga, similar to the lagepage in aix.
Why use big pages? The default block size for LINUX memory is 4 kb.
If the SGA is 128G
Select 128*1024*1024/4 from dual; 33554432 (more than 30 million ),
Select 128*1024/2 from dual; 65536
Each Memory Page has a page table item (about 10 bytes), which records the status and position of the page.
When the default block size is 4 K, the page table size is 320 MB.
When the page size is 2 MB, the page table only occupies. 625 MB.

In Linux, each process page table is independent and has its own page table.
If there are 1000 processes: 1000*320 m is about G.
While 1000 processes use large pages: 1000*0.625 = 625 M
A large page is set but not used by Oracle. There are only two reasons: (1) SGA_MAX_SIZE exceeds the large page.
(2) No Memory Lock is set
Memory: it is the stage of process activity. When the ORACLE database starts up, it will automatically find whether a large page is set.
If yes, allocate the SGA in the large page.
If not, use the default data block size to start normally.

#############
To set a large page:

1. view the current big 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-- The size of a large page is 2 MB.
BYS @ bys3> show parameter sga_max -- View database SGA size -- My Testing Machine
NAME TYPE VALUE
-----------------------------------------------------------------------------
Sga_max_size big integer 216 M

2. Set the number of large pages
-- Here is 200x2 M = 400 M. The maximum SGA size is 216 M. The memory size of the large page must be greater than the size of the SGA before it can be used by ORACLE. Therefore, I set 200.

Vi/etc/sysctl. conf
Add a line in it:
Vm. nr_hugepages = 200
Save and execute:
Sysctl-p
View: -- If HugePages_Free: less than 200, run the sysctl-p command several times.
[Root @ bys3 ~] # 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:-- The number of memlocks must be 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
[Root @ bys3 ~] # Ulimit-l
3500000 ----- this number is used to limit the number of large pages.

4. Restart the database. The large page has been used by ORACLE.
SYS @ bys3> shutdown immediate;
SYS @ bys3> startup

The database is continuously restarted. cat/proc/meminfo | grep Huge shows that the number of HugePages_Free 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.