Skip to content
Welcome To Charanjit Cheema Blog

Welcome To Charanjit Cheema Blog

An Open Source and Cloud Blog

Menu
  • Home
  • About Me!
  • Way to my Technical Blog
  • Contact me
  • Privacy Policy
Menu

What are Huge Pages and how to configure it in Linux for supporting Oracle SGA requirement

Posted on May 26, 2023May 26, 2023 by Charanjit Cheema

Huge Pages

In x86 Architecture, memory pages are like textbook pages where CPU use those pages for reading and writing them in virtual memory for addressing computing requirement. Technically, I can say it is a fixed size block of virtual memory which is defined as pages that has corresponding entry in page table and further this page table map the pages with fixed size memory frames of physical memory or also known as RAM. Operating Systems like Linux are capable of managing the physical memory with the help of virtual memory management at OS level.

In Linux default memory page size is 4KB. Although 4KB page size of memory is sufficient for running all types of Application but problem arises when you use Oracle database as Oracle uses its own method for memory management called SGA or Shared Global Area which supports large memory pool. Reason behind for SGA to support large memory pool is because it supports multiple components of database like database buffer, cache, shared pool, large pool etc. therefore using SGA with default memory page size would not be advisable as it will toll on Linux system in terms of high processing and wait time for accessing the memory.

Thus, to optimize performance and efficiency, it is often recommended to configure the large memory page appropriately when using Oracle database and the SGA. In Linux Huge page support larger memory pages sizes such as 2MB or 4MB, it enables the Linux to handle the large memory requirements of the SGA and reduce the overhead associated with accessing the memory. Huge pages cannot be swapped out to disk thus it also help in improving the performance.

 

Steps to configure the Huge Pages

In this blog I will explain the steps on how to configure the Huge Pages in Linux system. Note these steps require Oracle database downtime therefore perform this activity with an adequate database downtime window:

  1. Run the below command to check if Linux kernel supports Huge Page settings:

  1. Increase the memory lock limit to 90% of RAM (in KB value) in /etc/security/limits.conf file as this is required for supporting Huge Page size. As I have shown in below example my Linux system has 2.6 GB of memory and I have increased the memory locking value to 2453667 KB which is 90% of 2.6GB memory in KB size:

  1. Now login with oracle user id and verify the new memory locking setting:

  1. Now you need to create below hugepages_settings.sh shell script (latest script can also be downloaded from My Oracle Support note 401749.1) for calculating the recommended Huge pages value:
 
#!/bin/bash

#

# hugepages_setting.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' | '5.15' ) echo "Recommended setting: vm.nr_hugepages = $NUM_PG" ;;

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

esac

# End
  1. Once you create or download the latest huge pages value calculation shell script provide it an execution permission and run this script as below:

  1. Now configure the calculated Huge Page size value in /etc/sysctl.conf file:

  1. Run the below command for applying the configured Huge Page value:
sysctl -p
  1. Run below command to validate the applied Huge pages value and check available Huge Pages:

  1. You can now restart the database instance and run the below command again for validating the available Huge Pages in Linux system:
grep Huge /proc/meminfo

 

Loading

  • Author
  • Recent Posts
Charanjit Cheema
Follow him
Charanjit Cheema
Charanjit is currently working as a Cloud Architect at Mphasis, with 17 years of experience in IT infrastructure projects, implementation, and support. While his main role is as a DevOps engineer, he holds a Cloud Architect position and has strong skills in cloud technologies and automation. His expertise includes Terraform, Ansible, AWS, Azure DevOps, Azure Cloud, VMware, and Linux systems.

Charanjit is passionate about automating tasks and improving processes. He uses tools like Terraform and Azure DevOps to build and manage cloud infrastructure and streamline deployment. He also enjoys using Shell scripts and Ansible playbooks to make systems run more efficiently.

In his free time, Charanjit enjoys learning about new technologies and sharing his knowledge through his blog. When he’s not working, he likes listening to music, having a cup of coffee, and relaxing in nature.

You can connect with Charanjit on Twitter, Facebook, LinkedIn, or email him at charanjit.cheema@cjcheema.com.
Charanjit Cheema
Follow him
Latest posts by Charanjit Cheema (see all)
  • How to optimize the performance of Ansible Automation Platform or Ansible Tower - July 16, 2023
  • How to fix code and text file linting errors with the help of Visual Studio Code - June 27, 2023
  • How to migrate existing WordPress blog from AWS EC2 instance to Amazon Lightsail - May 29, 2023

Like this:

Like Loading...

Related

Leave a ReplyCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Tags

AWS Cloud Computing Dockers Networking Open Networking OpenSource RHEL-CentOS SDN Server Hardware SLES tcpdump Ubuntu WSL

Follow me @

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 2 other subscribers

Recent Posts

  • How to Deploy Docker Containers with NGINX on AWS EC2 Using Ansible and GitHub Actions
  • No More DynamoDB! Use Native S3 locking for Terraform State
  • How to Bring and Manage Manually Created AWS Resources Under Terraform Management
  • Iterating Cloud Resource Provisioning Using Terraform Count and For_Each Meta-Arguments
  • Terraform and Ansible Collaboration for AWS Cloud Deployment

Recent Comments

  1. Charanjit Singh on Terraform and Ansible Collaboration for AWS Cloud Deployment
  2. christinatodd2020aeaa798563 on Terraform and Ansible Collaboration for AWS Cloud Deployment
  3. Charanjit Singh on How to Set password policy in CentOS or RHEL system
  4. SAURABH on How to recover or rebuild initramfs in CentOS 7 Linux
  5. Sangita on How to Set password policy in CentOS or RHEL system

Archives

  • April 2025
  • February 2025
  • January 2025
  • August 2024
  • July 2024
  • June 2024
  • January 2024
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • September 2022
  • August 2022
  • July 2020
  • May 2020
  • February 2020
  • November 2019
  • June 2019
  • May 2019
  • March 2019
  • February 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • June 2018
  • May 2018
  • April 2018

Categories

  • Automation
  • Cloud Computing
  • Coding
  • CyberSecurity
  • Networking
  • OpenSource
  • RHEL-CentOS
  • Server Hardware
  • SLES
  • Technical Blog
  • Ubuntu
  • WSL

Blog Stats

  • 18,353 hits
Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Home
  • About Me!
  • Way to my Technical Blog
  • Contact me
  • Privacy Policy
© 2025 Welcome To Charanjit Cheema Blog | Powered by Superbs Personal Blog theme
 

Loading Comments...
 

    %d