Huge pages Series 3, hugepages Series

Source: Internet
Author: User

Huge pages Series 3, hugepages Series

Use the following shell script to calculate the large page configuration parameters. Make sure that the data instance has been started before using the script,

If the database version is 11 GB, check whether Automatic Memory Management (AMM) is used)

++ ++ ++
#! /Bin/bash
#
# Hugepages_settings.sh
#
# Linux bash script to compute values for
# Recommended HugePages/HugeTLB configuration
#
# 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
The recommended HugePages/HugeTLB configuration for the current shared
Memory segments. 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 HugePagesconfiguration,
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 notsetup
(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, $2 );}''

# 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 wherethe script is being executed ."
Exit 1
Fi

# Initialize the counter
NUM_PG = 0

# Cumulative number of pages required to handle the running shared memorysegments
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 100 MB does not make sense
# Bail out if that is the case
If [$ RES_BYTES-less than 100000000]; then
Echo "***********"
Echo "** ERROR **"
Echo "***********"
Echo "Sorry! There are not enough total of sharedmemory segments allocated
HugePages configuration. HugePages can only be used for shared memorysegments
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 notconfigured"
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 ";;
Esac

# End

++ ++ ++



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.