Note. Automatic Memory Management (AMM) is not compatible with HugePages, so apart from ASM instances and small unimportant databases, you will probably have no need for AMM on a real system. Instead, Automatic Shared Memory Management and Automatic PGA Management should be used as they are compatible with HugePages.
Run the following command to determine the current HugePage usage. The default HugePage size is 2MB on Oracle Linux 5.x.
$ grep Huge /proc/meminfo
Complete the following steps to configure HugePages on the server.HugePages_Total: 14097
HugePages_Free: 8813
HugePages_Rsvd: 7510
Hugepagesize: 2048 kB
1. Edit the memlock setting in the /etc/security/limits.conf file. The memlock setting is specified in KB and set slightly lesser than the installed RAM. For example, if you have 64GB RAM installed, add the following entries to increase the max locked memory limit (90% of the physical RAM):
Code: Select all
* soft memlock 60397977
* hard memlock 60397977
2. Login as the oracle user again and run the ulimit -l command to verify the new memlock setting:
$ ulimit -l
3. Run the following command to display the value of Hugepagesize variable:60397977
$ grep -i huge /proc/meminfo
4. Complete the following procedure to create a script that computes recommended values for hugepages configuration for the current shared memory segments:HugePages_Total: 22000
HugePages_Free: 22000
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
a. Create a text file named hugepages_settings.sh.
b. Add the following content in the file:
Code: Select all
#!/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
$ chmod +x hugepages_settings.sh
5. Run the hugepages_settings.sh script to compute the values for hugepages configuration:
$ ./hugepages_settings.sh
$ ./hugepages_settings.sh
Recommended setting: vm.nr_hugepages = 22000
6. Set the following kernel parameter:
# sysctl -w vm.nr_hugepages=value_displayed_in_step_5
7. To make the value of the parameter available for every time you restart the computer, edit the /etc/sysctl.conf file and add the following entry:
vm.nr_hugepages=value_displayed_in_step_5
8. Restart the server.
NOTE:
To check the available hugepages, run the following command:
$ grep Huge /proc/meminfo
9. Check the MEMORY_TARGET parameters are not set for the database and SGA_TARGET and PGA_AGGREGATE_TARGET parameters are being used instead.
SQL>show parameter target
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
archive_lag_target integer 0
db_flashback_retention_target integer 1440
fast_start_io_target integer 0
fast_start_mttr_target integer 300
memory_max_target big integer 0
memory_target big integer 0
parallel_servers_target integer 384
pga_aggregate_target big integer 514M
sga_target big integer 1008M
Note. If you are running Oracle 11.2.0.2 or later, you can set the USE_LARGE_PAGES initialization parameter to "only" so the database fails to start if it is not backed by hugepages.
Reference: http://www.oracle-base.com/articles/lin ... nux-64.php , http://docs.oracle.com/cd/E11882_01/ser ... pi_vlm.htm