Very Large Memory and HugePages Series 2-configure Large pages, largehugepages
How to configure hugepages on linux
Glossary:
Memlock-max locked-in-memory address space (KB)
1. Configuration/Etc/security/limits. conf memlock Parameter
Memlock is slightly smaller than the physical memory and greater than the SGA. If the physical memory is 64 GB, you can configure it like this.
Vi/Etc/security/limits. conf
* soft memlock 60397977* hard memlock 60397977
2. Verify the memlock settings of the oracle software user environment variable
$ ulimit -l60397977
3. View hugepages Information
$ grep Hugepagesize /proc/meminfo
[Oracle @ oracle11g-dag trace] $ grep Hugepagesize/proc/meminfo
Hugepagesize: 2048 kB
4. Use an oracle script to calculate the HugePages/HugeTLB Setting Value
#!/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 versionKERN=`uname -r | awk -F. '{ printf("%d.%d\n",$1,$2); }'`# Find out the HugePage sizeHPG_SZ=`grep Hugepagesize /proc/meminfo | awk {'print $2'}`# Start from 1 pages to be on the safe side and guarantee 1 free HugePageNUM_PG=1# Cumulative number of pages required to handle the running shared memory segmentsfor 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` fidone# Finish with resultscase $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
5. Write the configuration file vi
/Etc/sysctl. conf
vm.nr_hugepages=value_displayed_in_step_4
6. Restart the server
Verify Configuration:
grep Huge /proc/meminfo
Restrictions of hugepages:
. Oracle Automatic Memory Management (AMM) memory_target and hugepages cannot coexist;
If you are using VLM in a 32-bit environment, then you cannot use HugePages for the Database Buffer cache. You can use HugePages for other parts of the SGA, suchshared_pool
,large_pool
, And so on. Memory allocation for VLM (buffer cache) is done using shared memory file systems (ramfs/tmpfs/shmfs
). Memory file systems do not reserve or use HugePages.
HugePages are not subject to allocation or release after system startup, unless a system administrator changes the HugePages configuration, either by modifying the number of pages available, or by modifying the pool size. if the space required is not reserved in memory during system startup, then HugePages allocation fails