The 3DEXPERIENCE platform only supports a few operation systems to use as servers. For example, RHEL(redhat enterprise Linux) 7.x is needed to open HugePages, because it is not opened by default.
For large SGA (System Global Area, which is memory used by Oracle for an instance shared to all clients) sizes, HugePages can give substantial benefits in virtual memory management. Without HugePages, the memory of the SGA is divided into 4K pages, which have to be managed by the Linux Kernel. Using HugePages, the page size is increased to 2MB, thereby reducing the total number of pages to be managed by the Kernel, and therefore, reducing the amount of memory required to hold the page table in memory.
In addition to these changes, the memory associated with HugePages cannot be swapped out, which forces the SGA to remain the memory resident. The savings in memory and the effort of page management make HugePages pretty much mandatory for Oracle running on x86-64 architectures. Be sure to check with your Infrastructure/IT/DBA team if HugePages is opened.
5 Steps to open HugePages:
Step 1. ensure your have the database backup, if not , then back it up first.
Step 2. disable transparent_hugepage, which is opened by default for RHEL - and can be in conflict with HugePages. So we need to disable it - execute: cat /sys/kernel/mm/transparent_hugepage/enabled
It shows [always] madvise never, after our modify , it will change to always madvise [never]
use root
grubby --default-kernel
### got result as /boot/vmlinuz-3.10.0-1127.18.2.el7.x86_64 as example
grubby --info /boot/vmlinuz-3.10.0-1127.18.2.el7.x86_64
### use the result you got from the previous command
grubby --args="transparent_hugepage=never" --update-kernel /boot/vmlinuz-3.10.0-1127.18.2.el7.x86_64
reboot
cat /sys/kernel/mm/transparent_hugepage/enablednow transparent_hugepage is disabled.
Step 3. Copy text below into hugepages.sh, chmod u+x hugepages.sh ,
and execute it ./hugepages.sh to get the number suggested for HugePages
#!/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' | '3.8' | '3.10' | '4.1' | '4.14' ) echo "Recommended setting: vm.nr_hugepages = \\\$NUM_PG" ;;
*) echo "Unrecognized kernel version \\\$KERN. Exiting." ;;
esac
# End
edit /etc/sysctl.conf add below line, the number is calculated by previous step, assume it is 77571
vm.nr_hugepages=77571
#sysctl -p # to load setting from sysctl.conf
grep Huge /proc/meminfo #to check if Hugepages is set
You will see HugePages_Total is the number you set, (sorry the picture is not same as my example)
and HugePages_Free will get smaller and smaller, it is being used by oracle.
Step 4 At oracle disable AMM
two parameter should be 0
memory_target
memory_max_target
Enable ASMM
Set SGA_Target to a number which not exceed huge page size. 77571*2048=158865408K
alter system set sga_target= 155136M;
alter system set sga_max_size= 155136M;
Step 5
Ensure oracle user's ulimit -l is enough, it should be bigger than the value for HugePages 77571*2048=158865408KB, or you can set to 90% of the physical memory.
If not big enough
set at /etc/security/limit.conf
oracle hard memlock 158865408
oracle soft memlock 158865408
reconnect oracle user to check if the ulimit -l increase
You also may need to restart oracle.
OK now, enjoy the performance improvement on Oracle. :)
Tips and Tricks
