Configure HugePage in Linux
For Oracle database servers with large memory, it is necessary to configure HugePage. The following describes how to configure Huge:
My environment:
OS: CentOS release 6.4 (Final)
Oracle: 11.2.0.4 RAC
HugePage needs to be configured for large Oracle memory
Enable detailed parsing of huge pages on Oracle 11.2.0.3.0
Linux HugePages and MySQL large page configuration
Linux HugePage features
1. Set memlock
Edit/etc/security/limits. conf
Added:
* Soft memlock is slightly smaller than the RAM Value
* Hard memlock is slightly smaller than the RAM Value
It does not matter if the Memlock value is greater than sga, so we can set this value between the desired SGA size and the physical memory size, which is measured in kb.
[Root @ node1 ~] # Grep-I memtot/proc/meminfo
MemTotal: 132250576 kB
The physical memory size is 126 GB, so I can set memlock to 100 GB.
Set in two nodes:
[Root @ node1 ~] # Tail-2/etc/security/limits. conf
* Soft memlock 104857600
* Hard memlock 104857600
After the settings are complete, log on to the Oracle user for verification:
Node2-> ulimit-l
104857600
2. Disable the AMM feature:
To disable the AMM feature, you need to reset the memory_max_target and memory_max_targetparameters, instead of setting them to 0. The best way is to create a pfile and delete these two parameters in pfile, create a spfile based on this pfile.
The main memory parameters are as follows:
Node1->
Node1-> grep target/tmp/init. ora
*. Pga_aggregate_target = 1572864000
*. Sga_target = 64424509440
SQL> create spfile from pfile = '/tmp/init. ora ';
File created.
SQL> startup force
ORA-27102: out of memory
Linux-x86_64 Error: 28: No space left on device
Additional information:-134217728
Additional information: 1
SQL>
This error is reported because the shmall setting is too small.
Shmall indicates the total size of the shared memory, in the unit of pagesize.
According to my configuration, SGA with a maximum of 8 GB is supported:
Node1-> getconf PAGE_SIZE
4096
Node1-> cat/proc/sys/kernel/shmall
2097152
Modify shmall and restart the database. The modification method is simple. edit/etc/sysctl. conf:
Kernel. shmall = 16252928
You can.
After modifying kernel. shmall, You can restart the database.
SQL> startup nomount pfile = '/tmp/init. ora ';
ORACLE instance started.
Total System Global Area 6.4137E + 10 bytes
Fixed Size 2269072 bytes
Variable Size 6979321968 bytes
Database Buffers 5.7043E + 10 bytes
Redo Buffers 112762880 bytes
SQL>
SQL>
After the DB is started, re-create the spfile:
SQL> create spfile = '+ OCR/sszgdb/spfilesszgdb. ora' from pfile = '/tmp/init. ora ';
File created.
SQL>
3. Calculate the hugepage Size Based on the Oracle script (make sure that Oracle has been started During computation). You can also calculate the size by yourself:
Press Enter to proceed...
Recommended setting: vm. nr_hugepages = 30739
Node1->
4. edit/etc/sysctl. conf Based on the computing value of the script on two nodes.
Join vm. nr_hugepages = 30739
[Root @ node2 ~] # Grep-I huge/proc/meminfo
AnonHugePages: 602112 kB
HugePages_Total: 30739
HugePages_Free: 30739
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB to stop a database instance
5. Restart the server. Generally, the DB is automatically started after the server is restarted. After the server and DB are restarted, run the following command to verify the usage of the large page:
Grep-I Hugepages/proc/meminfo
In this case, you can view the Oracle alert Log and find:
Starting ORACLE instance (normal)
* ********************** Large Pages Information ************* ******
Per process system memlock (soft) limit = UNLIMITED
Total Shared Global Region in Large Pages = 58 GB (96%)
Large Pages used by this instance: 29761 (58 GB)
Large Pages unused system wide = 24 (48 MB)
Large Pages configured system wide = 30739 (60 GB)
Large Page size = 2048 KB
RECOMMENDATION:
Total System Global Area size is 60 GB. For optimal performance,
Prior to the next instance restart:
1. Increase the number of unused large pages
At least 936 (page size 2048 KB, total size 1872 MB) system wide
Get 100% of the System Global Area allocated with large pages
We can find that sga is not all placed on a large page, which may have a negative impact on performance. We recommend that you add another 936 large page in Oracle. It can be seen that the large page script computing in Oracle is not accurate, we need to increase the page size and set the parameter Use_large_pages = only. This parameter ensures that all the Oracle shared memory uses a large page.
For more details, please continue to read the highlights on the next page: