Oracle Huge Pages

 Huge pages is actually required to manage huge SGA . While coming to the concept SGA is swanned based on the granules where each granule count increases based on the accumulated data into data buffer and this will be mapped to physical OS block.

OS block is defined in terms of  1MB or more , so let us assume for 512MB RAM , allocates 1MB*512 Blocks. So instead of relying on physical blocks lets define a page /huge page which swanned across blocks and allocates the pages to SGA resulting into better memory processing.


In Oracle we can forcefully make a database memory to use huge pages with the parameter use_larege_page 

ALTER SYSTEM SET use_large_pages=only SCOPE=SPFILE

Shut immediate

Note: The Oracle 11g Automatic Memory Management (AMM) feature is not compatible with Linux HugePages. In order to utilize HugePages, the Automatic Shared Memory Management (ASMM) feature can be configured for the Oracle database.


To configure Oracle to support Linux HugePages, perform the following steps for each Oracle database on the server:


Set the Oracle parameters "memory_target" = 0 and "memory_max_target" = 0

Set the Oracle parameter "sga_target" = SGA size desired for the database

Set the Oracle parameter "pga_aggregate_target" = PGA size desired for the database

Restart the Oracle database to allow these parameter settings to take affect



Create the file hugepages_settings.sh with the following content (taken from the My Oracle Support (MOS) note 401749.1).


#!/bin/bash

#

# hugepages_settings.sh

#

# Linux bash script to compute values for the

# 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.

# 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'}`

# Start from 1 pages to be on the safe side and guarantee 1 free HugePage

NUM_PG=1

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

for SEG_BYTES in `ipcs -m | awk {'print $5'} | 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

# Finish with results

case $KERN in

   '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" ;;

    *) echo "Unrecognized kernel version $KERN. Exiting." ;;

esac

#END


Comments

Popular posts from this blog

Understanding Terraform

How to make CRS and ASM not to restart after server reboot

How to repair ASM disk header