HUGE PAGES 

 

  1. What are Huge Pages?

    Linux Manages memory in pages while loading data from disk to memory or writing back to disk from memory.
    Huge pages is a Linux feature introduced in kernel version 2.6 to manage memory in large pages (more than 4KB) n 4KB)
    Linux supports both normal-sized memory pages and large-sized memory pages.
    it will reduce the required operating system resources to access very large pages. 

 

  1. why huge pages for Oracle?

    Oracle Databases, using Huge Pages reduces the operating system maintenance of page states and improves the performance of the system.
    Without huge Pages, the operating system keeps each 4 KB of memory as a page. When it allocates pages to the database System Global Area (SGA), 
    the operating system kernel must continually update its page table with the page lifecycle (dirty, free, mapped to a process, and so on) for each 4 KB page allocated to the SGA
     

  2. How to configure huge pages to check whether huge pages are configured or not 
    cat /sys/kernel/mm/redhat_transparent_hugepage/enabled

    [always] never

    from the above output, it is enabled.

    if you want to disable it, please add the below entry in /etc/grub.conf and reboot the system

    transparent_hugepage=never

     

  3. How to check the existing values of the huge pages

    $ grep Huge /proc/meminfo  or  grep vm.nr_hugepages /etc/sysctl.conf 

 

  1. How to change the existing values

    sysctl -w vm.nr_hugepages=value

    set the value and restart the system and check the value 

 

Huge Page Calculations: 

#!/bin/bash 

# Get the size of memory in MB 

total_mem=$(awk ‘/MemTotal/ {print $2}’ /proc/meminfo) 

total_mem=$((total_mem / 1024)) 

# Get the hugepage size 

hugepage_size=$(awk ‘/Hugepagesize/ {print $2}’ /proc/meminfo) 

hugepage_size=$((hugepage_size / 1024)) 

 # Calculate the number of Hugepages required 

hugepages_needed=$((total_mem / hugepage_size)) 

 # Round up to the nearest integer 

hugepages_needed=$((hugepages_needed + 1)) 

 # Print the result 

echo “Hugepages needed: $hugepages_needed” 

 

This script calculates the total size of memory on the system by reading the value of the MemTotal field in the /proc/meminfo file, which provides information about the system’s memory usage. The size of huge pages is obtained by reading the value of the Hugepagesize field in the same file. The script then calculates the number of Huge Pages required by dividing the total memory by the size of a huge page and rounding it up to the nearest integer. Finally, it prints the result. 

 

There are several limitations to consider when using huge pages

Hugepage size of is generally 2 MB or 1 GB, but the factual size may vary depending on the system. Larger sizes can affect better performance, but also increase the memory outflow of the system.

Memory overhead huge pages consume a significant quantum of memory for the secretary and operation, which can affect a significant memory outflow for the system.

Memory fragmentation huge pages can beget memory fragmentation, as they can only be allocated in large conterminous blocks. This can affect a situation where there’s enough free memory available, but it isn’t conterminous, and thus cannot be used to allocate huge pages.

operation comity Not all operations are compatible with Hugepages and may witness performance decline or other issues. operations that use large quantities of memory, or that constantly allocate and deallocate memory, may not work well with Hugepages.

Process insulation Hugepages are participated by all processes on the system, which can affect a situation where one process is using all the available Hugepages, and other processes are unfit to allocate memory.

Overcommit Hugepages can make it easier to commit memory on the system, as they’re reserved at charge time and cannot be freed until the system is rebooted.

In general, huge pages can give performance benefits for certain workloads, but careful consideration should be given to the limitations and trade-offs involved. It’s important to completely test any configuration changes to ensure that they don’t have a negative impact on system performance or stability. 

 

 

Recent Posts

Start typing and press Enter to search