Configure HugePage for Oracle 11gR2 in Linux

Source: Internet
Author: User

Configure HugePage for Oracle 11gR2 in Linux

HugePage is a performance optimization tool for Oracle in Linux. For database systems in the shared memory area (SGA), we recommend that you configure HugePage at the operating system level to provide larger available shared memory and full memory for Oracle instances.

This article describes how to configure HugePage in Oracle 11gR2. Record it and all the friends who need it are waiting to be checked.

Use HugePages to optimize memory performance

Use HugePage in PF_RING Libzero

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. Environment Introduction

I use the Oracle 11gR2 system. The specific version is 11.2.0.4.

SQL> select * from v $ version;

BANNER

--------------------------------------------------------------------------------

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0-64bit Production

PL/SQL Release 11.2.0.4.0-Production

CORE 11.2.0.4.0 Production

TNS for Linux: Version 11.2.0.4.0-Production

NLSRTL Version 11.2.0.4.0-Production

The Memory Policy configured for the current database is ASMM, that is, set the size range of PGA and SGA respectively. Oracle dynamically adjusts the space of each sub-pool based on the load. Note: In the current version, the AMM (Automatic Memory Management) and HugePage are still incompatible. Therefore, if you want to configure HugePage, select ASMM instead.

The SGA space set in the database is as follows:

SQL> show parameter sga;

NAME TYPE VALUE

-----------------------------------------------------------------------------

Lock_sga boolean FALSE

Pre_page_sga boolean FALSE

Sga_max_size big integer 12G

Sga_target big integer 12G

During the startup of 12g SGA and Oracle, a prompt is displayed in alert log for large memory.

Ue Jan 12 11:31:33 2016

Starting ORACLE instance (normal)

* ********************** Large Pages Information ************* ******

Per process system memlock (soft) limit = 64 KB

Total Shared Global Region in Large Pages = 0 KB (0%)

Large Pages used by this instance: 0 (0 KB)

Large Pages unused system wide = 0 (0 KB)

Large Pages configured system wide = 0 (0 KB)

Large Page size = 2048 KB

RECOMMENDATION:

Total System Global Area size is 12 GB. For optimal performance,

Prior to the next instance restart:

1. Increase the number of unused large pages

At least 6145 (page size 2048 KB, total size 12 GB) system wide

Get 100% of the System Global Area allocated with large pages

2. Large pages are automatically locked into physical memory.

Increase the per process memlock (soft) limit to at least 12 GB to lock

100% System Global Area's large pages into physical memory

First, Oracle found that the current system does not set HugePage, only the default 2 MB Page is optional. Therefore, from the perspective of suggestion, a prompt is provided. We recommend that you enable the HugePage option at the operating system level. At this time, there are no special settings at the operating system level.

[Oracle @ PROD_PC-DB trace] $ grep Huge/proc/meminfo

AnonHugePages: 36864 kB

HugePages_Total: 0

HugePages_Free: 0

HugePages_Rsvd: 0

HugePages_Surp: 0

Hugepagesize: 2048 kB

2. Configure HugePage

In the minor version 11.2, the behavior processed by HugePage is actually changing. In 11.2.0.2, Oracle introduced the use_large_page parameter, which is used to control Oracle's use of the Huge Page at the instance level.

SQL> show parameter large_pages

NAME TYPE VALUE

-----------------------------------------------------------------------------

Use_large_pages string TRUE

The default value of this parameter is true, which is an upward optimal policy. If this parameter is set to true, the Oracle instance checks whether HugePage is enabled in the operating system. If this parameter is set to true, the Oracle instance uses HugePage. The other two values are false and only. If false is selected, HugePage is not used for Oracle instances regardless of operating system settings. If you select only, the Oracle instance will only run on HugePage.

In addition, there are also some changes in behavior. In version 11.2.0.2, if the operating system does not have enough HugePage, the SGA memory will only use the remaining Small Pages of the system (Small Pages ). If the remaining small page is not enough, or the kernel is used a lot, the system reports an error in the ora-4030.

This situation has some changes in version 11.2.0.3. Oracle will first use the available HugePage. If it is used up, the remaining small pages will also be used as SGA. The change lies in the way HugePage is used, according to the official statement:

With this new behavior additional shared memory segments are an expected side effect. part of the change is to ensure that each shared memory segment making up the SGA only contains sub-areas with an identical alignment requirement-hence the SGA will spread over more separate SHM segments. in this supported mixed page mode the database will exhaust the available hugepages, before switching to regular sized pages.

The new version allows you to better use available large page resources. The current operating system version is Linux 2.6 kernel version.

[Oracle @ PROD_PC-DB trace] $ uname-r

2.6.32-431. el6.x86 _ 64

This process involves the number of recommended hugepages in different operating system environments and different Oracle configurations. Oracle released a Shell script hugepages_settings.sh on MOS to dynamically calculate the recommended HugePage quantity.

The specific script content can be downloaded from MOS Doc ID 401749.1, which is also involved in the author's previous articles on HugePage. After the script is executed, the result is as follows:

[Oracle @ PROD_PC-DB trace] $ ls-l | grep hugepag

-Rw-r --. 1 oracle oinstall 3129 Jan 12 hugepages_settings.sh

[Oracle @ PROD_PC-DB trace] $ chmod + x hugepages_settings.sh

[Oracle @ PROD_PC-DB trace] $ ls-l | grep hugepag

-Rwxr-xr-x. 1 oracle oinstall 3129 Jan 12 hugepages_settings.sh

[Oracle @ PROD_PC-DB trace] $ uname-r

2.6.32-431. el6.x86 _ 64

[Oracle @ PROD_PC-DB trace] $./hugepages_settings.sh

This script is provided by Doc ID 401749.1 from My Oracle Support

(Http://support.oracle.com) where it is intended to compute values

The recommended HugePages/HugeTLB configuration for the current shared

Memory segments on Oracle Linux. Before proceeding with the execution please note following:

* For ASM instance, it needs to configure ASMM instead of AMM.

* The 'pga _ aggregate_target 'is outside the SGA and

You shoshould accommodate this while calculating SGA size.

* In case you changes the db sga size,

As the new SGA will not fit in the previous HugePages configuration,

It had better disable the whole HugePages,

Start the DB with new SGA size and run the script again.

And make sure that:

* Oracle Database instance (s) are up and running

* Oracle Database 11g Automatic Memory Management (AMM) is not setup

(See Doc ID 749851.1)

* The shared memory segments can be listed by command:

# Ipcs-m

Press Enter to proceed...

Recommended setting: vm. nr_hugepages = 6148

HugePage must be configured at the operating system level. The limits. conf file is used in advance to enable the user's memory limit.

[Root @ PROD_PC-DB security] # vi limits. conf

#/Etc/security/limits. conf

#

# Each line describes a limit for a user in the form:

#

(Space reasons, omitted ......)

Oracle soft nproc 2047

Hard nproc 16384

Oracle soft nofile 1024

Oracle hard nofile 65536

Oracle soft memlock 32879476-total memory size

Oracle hard memlock 32879476

Confirm the modification.

[Oracle @ PROD_PC-DB ~] $ Ulimit-l

32879476

Modify the result calculated by the script into the/etc/sysctl. conf file.

Net. ipv4.ip _ local_port_range = 9000 65500

Net. core. rmem_default = 262144

Net. core. rmem_max = 4194304

Net. core. wmem_default = 262144

Net. core. wmem_max = 1048576

Fs. aio-max-nr = 1048576

Fs. file-max = 6815744

Vm. nr_hugepages = 6148

"/Etc/sysctl. conf" 67L, 1631C written

Execute sysctl-p to implement the modification.

[Root @ PROD_PC-DB security] # sysctl-p

Net. ipv4.ip _ forward = 0

Net. ipv4.conf. default. rp_filter = 1

(Space reasons, omitted ......)

Fs. file-max = 6815744

Vm. nr_hugepages = 6148

Restart the instance database.

SQL> conn/as sysdba

Connected.

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL> startup

ORACLE instance started.

Total System Global Area 1.2827E + 10 bytes

Fixed Size 2265224 bytes

Variable Size 2214596472 bytes

Database Buffers 1.0603E + 10 bytes

Redo Buffers 7307264 bytes

Database mounted.

Database opened.

SQL>

At the operating system level, you can see the HugePage usage.

[Oracle @ PROD_PC-DB ~] $ Ipcs-m

------ Shared Memory Segments --------

Key shmid owner perms bytes nattch status

0x00000000 786435 oracle 640 67108864 22

0x00000000 819204 oracle 640 12817793024 22

0x617ab988 851973 oracle 640 2097152 22

[Oracle @ PROD_PC-DB ~] $ Grep Huge/proc/meminfo

AnonHugePages: 20480 kB

HugePages_Total: 6148

HugePages_Free: 5531

HugePages_Rsvd: 5528

HugePages_Surp: 0

Hugepagesize: 2048 kB

At the same time, the recommendation prompt information disappears during startup.

Tue Jan 12 14:26:30 2016

Starting ORACLE instance (normal)

* ********************** Large Pages Information ************* ******

Per process system memlock (soft) limit = 31 GB

Total Shared Global Region in Large Pages = 12 GB (100%)

Large Pages used by this instance: 6145 (12 GB)

Large Pages unused system wide = 3 (6144 KB)

Large Pages configured system wide = 6148 (12 GB)

Large Page size = 2048 KB

**************************************** ****************************

LICENSE_MAX_SESSION = 0

LICENSE_SESSIONS_WARNING = 0

Initial number of CPU is 8

Number of processor cores in the system is 8

Number of processor sockets in the system is 1

Picked latch-free SCN scheme 3

Using LOG_ARCHIVE_DEST_1 parameter default value as USE_DB_RECOVERY_FILE_DEST

Autotune of undo retention is turned on.

IMODE = BR

3. Conclusion

For the Oracle shared memory system that is put into production in the Linux version, it is of practical significance to configure HugePage.

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.