Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Linux configuration large page HugePages

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

When to configure when

IF

SGA > = 2GB AND sessions > = 500,

THEN

Enabling HugePages becomes a requirement on Linux 64-bit system.

2. How to configure How to Configure HugePages

Step 3: If you have Oracle Database 11g or later, the default database created uses the Automatic Memory Management (AMM) feature which is incompatible with HugePages. Disable AMM before proceeding. To disable, set the initialization parameters MEMORY_TARGET and MEMORY_MAX_TARGET to 0 (zero). Please see Document 749851.1 for further information in case you encounter the error below:

$. / hugepages_settings.sh

...

Recommended setting: vm.nr_hugepages = 1496

$

Note: You can also calculate a proper value for the parameter yourself but that is not advised if you do not have extensive experience with HugePages and concepts.

Step 5: Edit the file / etc/sysctl.conf and set the vm.nr_hugepages parameter there:

...

Vm.nr_hugepages = 1496

...

This will make the parameter to be set properly with each reboot.

Step 6: Stop all the database instances and reboot the server

(Although settings could have been done dynamically they would not be effective to the extent we require before a reboot. The best practice is to do a persistent system configuration and perform a reboot to complete the configuration as presented through the steps above)

# grep HugePages / proc/meminfo

HugePages_Total: 1496

HugePages_Free: 485

HugePages_Rsvd: 446

HugePages_Surp: 0

The values in the output will vary. To make sure that the configuration is valid, the HugePages_Free value should be smaller than HugePages_Total and there should be some HugePages_Rsvd. HugePages_Rsvd counts free pages that are reserved for use (requested for an SGA, but not touched/mapped yet).

The sum of Hugepages_Free and HugePages_Rsvd may be smaller than your total combined SGA as instances allocate pages dynamically and proactively as needed.

Fourth, calculate large pages of Shell Script to Calculate Values Recommended Linux HugePages / HugeTLB Configuration

1. [root@wang ~] # vi hugepages_settings.sh

-- add the following script

#! / bin/bash

#

# hugepages_settings.sh

#

# Linux bash script to compute values for the

# recommended HugePages/HugeTLB configuration

# on Oracle Linux

#

# Note: This script does calculation for all shared memory

# segments available when the script is run, no matter it

# is an Oracle RDBMS shared memory segment or not.

#

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

# http://support.oracle.com

# Welcome text

Echo "

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

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

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 should 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... "

Read

# Check for the kernel version

KERN= `uname-r | awk-F. '{printf ("% d% d\ n", $1);}' `

# Find out the HugePage size

HPG_SZ= `grep Hugepagesize / proc/meminfo | awk'{print $2}'`

If [- z "$HPG_SZ"]; then

Echo "The hugepages may not be supported in the system where the script is being executed."

Exit 1

Fi

# Initialize the counter

NUM_PG=0

# Cumulative number of pages required to handle the running shared memory segments

For SEG_BYTES in `ipcs-m | cut-C44-300 | awk'{print $1}'| grep "[0-9] [0-9] *" `

Do

MIN_PG= `echo "$SEG_BYTES/ ($HPG_SZ*1024)" | bc-q`

If [$MIN_PG-gt 0]; then

NUM_PG= `echo "$NUM_PG+$MIN_PG+1" | bc-q`

Fi

Done

RES_BYTES= `echo "$NUM_PG * $HPG_SZ * 1024" | bc-q`

# An SGA less than 100MB does not make sense

# Bail out if that is the case

If [$RES_BYTES-lt 100000000]; then

Echo "*"

Echo "* * ERROR * *"

Echo "*"

Echo "Sorry! There are not enough total of shared memory segments allocated for

HugePages configuration. HugePages can only be used for shared memory segments

That you can list by command:

# ipcs-m

Of a size that can match an Oracle Database SGA. Please make sure that:

* Oracle Database instance is up and running

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

Exit 1

Fi

# Finish with results

Case $KERN in

'2.2') echo "Kernel version $KERN is not supported. Exiting."

'2.4') HUGETLB_POOL= `echo "$NUM_PG*$HPG_SZ/1024" | bc-q`

Echo "Recommended setting: vm.hugetlb_pool = $HUGETLB_POOL"

'2.6') echo "Recommended setting: vm.nr_hugepages = $NUM_PG"

'3.8') echo "Recommended setting: vm.nr_hugepages = $NUM_PG"

'3.10') echo "Recommended setting: vm.nr_hugepages = $NUM_PG"

'4.1') echo "Recommended setting: vm.nr_hugepages = $NUM_PG"

Esac

# End

"hugepages_settings.sh" [New] 94L, 3254C written

[root@wang ~] #

2. [root@wang ~] # chmod + x hugepages_settings.sh

3. [root@wang ~] #. / hugepages_settings.sh

.

Omit.

Press Enter to proceed...

Recommended setting: vm.nr_hugepages = 102404

The suggestion value will be output after execution.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report