Monday, December 3, 2018

All about HugePages for Oracle Database

4.1.5 Restrictions for HugePages and Transparent HugePages Configurations
Review the following guidelines for HugePages and Transparent HugePages. Oracle recommends that you disable Transparent HugePages, because they may
causes delays in accessing memory that can result in node restarts in Oracle RAC environments, or performance issues or delays for Oracle Database
single instances. Oracle continues to recommend using standard HugePages for Linux. Transparent HugePages memory is enabled by default with Red Hat
Enterprise Linux 6, Red Hat Enterprise Linux 7, SUSE 11, Oracle Linux 6, and Oracle Linux 7 with earlier releases of Oracle Linux Unbreakable
Enterprise Kernel 2 (UEK2) kernels.
Transparent HugePages memory is disabled by default in later releases of UEK2 and later UEK kernels.
Note: Although Transparent HugePages is disable on UEK2 and later UEK kernels, Transparent HugePages may be enabled by default on your Linux system.
Transparent Hugepages are similar to standard HugePages. However, while standard HugePages allocate memory at startup, Transparent Hugepages memory uses the
khugepaged thread in the kernel to allocate memory dynamically during runtime,using swappable HugePages.
HugePages allocates non-swappable memory for large page tables using memorymapped files. HugePages are not enabled by default. If you enable HugePages, then
you should deduct the memory allocated to HugePages from the available RAM before calculating swap space. Refer to your distribution documentation and to Oracle
Technology Network and My Oracle Support for more information.
During Oracle Grid Infrastructure installation, the Grid Infrastructure Management Repository (GIMR) is configured to use HugePages. Because the Grid Infrastructure
Management Repository database starts before all other databases installed on the cluster, if the space allocated to HugePages is insufficient,
then the System Global Area (SGA) of one or more databases may be mapped to regular pages, instead of Hugepages, which can adversely affect performance.
Configure the HugePages memory allocation to a size large enough to accommodate the sum of the SGA sizes of all the databases you intend to install on
the cluster, as well as the Grid Infrastructure Management Repository.
For detailed explanation check the references.

To check transparent HugePages
[oracle@testrac1 dbs]$ egrep 'trans|thp' /proc/vmstat
nr_anon_transparent_hugepages 0
thp_fault_alloc 0
thp_fault_fallback 0
thp_collapse_alloc 0
thp_collapse_alloc_failed 0
thp_split 0
thp_zero_page_alloc 0
thp_zero_page_alloc_failed 0

To check HugePages Size
[oracle@testrac1 ~]$ grep Hugepagesize /proc/meminfo
Hugepagesize:       2048 kB

To check HugePage
[oracle@testrac1 dbs]$ grep HugePages /proc/meminfo
AnonHugePages:         0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0

Add value to configuration file and apply it
[root@testrac1 ~]#vi /etc/sysctl.conf
# HugePages
vm.nr_hugepages =2864

[root@testrac1 ~]# sysctl -p

[root@testrac1 ~]# grep HugePages /proc/meminfo
AnonHugePages:         0 kB
HugePages_Total:    2864
HugePages_Free:     2864
HugePages_Rsvd:        0
HugePages_Surp:         0

References:
https://www.carajandb.com/en/blog/2016/7-easy-steps-to-configure-hugepages-for-your-oracle-database-server/
https://oracle-base.com/articles/linux/configuring-huge-pages-for-oracle-on-linux-64
https://www.thegeekdiary.com/centos-rhel-67-how-to-configure-hugepages/
https://docs.oracle.com/cd/E37670_01/E37355/html/ol_config_hugepages.html
https://docs.oracle.com/cd/E11882_01/server.112/e10839/appi_vlm.htm#UNXAR393
https://wadhahdaouehi.tn/2016/10/enable-hugepages-rhel-7ol-7-within-oracle-database-12c/
Metalinks :
https://mehmandba.blogspot.com/2018/05/hugepages-on-linux-what-it-is-and-what.html
https://mehmandba.blogspot.com/2018/05/oracle-linux-shell-script-to-calculate.html