Select Page

HugePages Setup for Linux

Author: Eric Russo | | December 28, 2018

Using HugePages for Linux with Oracle: What You Need to Know

Computer memory is managed in blocks of storage known as pages, which have a predetermined size that depends on the computer’s architecture. These pages are organized using a page table, which is a data structure that links virtual memory addresses to their physical location in memory.

As companies store more and more information in their enterprise databases, using large amounts of memory becomes slower and more inefficient as the default memory page size remains the same.

To address this issue, several flavors of the Linux operating system have implemented a feature known as HugePages–so what exactly do you need to know about them, and how do they impact your Oracle environment?

What are HugePages and Why Do They Matter?

HugePages are a feature in the Linux operating system that allow the Linux kernel to manage large pages of memory.

The x86 and x86-64 instruction sets have standard page sizes of 4 kilobytes, while the IA-64 instruction set has a standard page size of 16 kilobytes. HugePages significantly enhance these storage capabilities: they are 4 megabytes in size on x86, 2 megabytes in size on x86-64, and 256 megabytes on IA-64.

HugePages are allocated when the computer boots, and they remain pinned in memory. This means that the kernel swap daemon (kswapd) does not need to manage them, and the Linux kernel does not need to perform page table lookup for them.

In other words, HugePages enable you to dramatically reduce your page table overhead, especially when dealing with large System Global Areas (SGAs). They reduce the likelihood of bottlenecks when accessing page tables, thereby providing a noticeable increase in performance.

When Should You Use HugePages?

According to Oracle, you should enable the HugePages feature if you have a system with more than 16 gigabytes of memory running Oracle databases with a total SGA larger than 8 gigabytes. Realistically, however, any database with an SGA size of 100 megabytes or more can benefit from using HugePages.

HugePages are a “use it or lose it” feature, so you should make sure that they aren’t going to waste in your Oracle environment. Below, we provide a simple script that you can use to determine if HugePages are enabled and, if so, whether any of them are going unused.

You can enable HugePages by first setting the Linux initialization parameter vm.nr_hugepages to the number of pages that you want to make available for the Oracle Database SGA, and then rebooting the server.

Note that Oracle’s Automatic Memory Management (AMM) feature is not compatible with HugePages in Oracle Database 11g and later. You must disable AMM in order to be able to use HugePages.

Disabling Transparent HugePages

Transparent HugePages are similar to HugePages, but have one crucial point of distinction. While HugePages must be preallocated at boot, Transparent HugePages are set up dynamically at run time by the khugepaged thread in the Linux kernel.

Unfortunately, Transparent HugePages are known to cause issues such as unexpected node reboots and performance problems with Oracle Real Application Clusters (RAC). They may also cause problems or delays even in a single-instance database environment.

Transparent HugePages are implemented and enabled by default beginning with Red Hat Enterprise Linux 6, SUSE 11, Oracle Linux 6, and Unbreakable Enterprise Kernel Release 2. Due to the difficulties listed above, however, Oracle recommends disabling Transparent HugePages on all Linux database servers running Oracle.

In order to determine whether transparent HugePages are in use, run the following command at the Linux command line:

$ grep -i hugepage /proc/meminfo

AnonHugePages: 6602752 kB

HugePages_Total: 0

HugePages_Free: 0

HugePages_Rsvd: 0

HugePages_Surp: 0

Hugepagesize: 2048 kB

In this example, you can see that HugePages are not in use, but that Transparent HugePages are. To disable Transparent HugePages, add the following to the kernel boot line in your /etc/grub.conf file and reboot the server:

transparent_hugepage=never

Final Thoughts

The most important pieces of information that you should take away from this article are:

  • If your database has an SGA size of 100 megabytes or greater, then you can likely benefit from using HugePages. However, Oracle suggests that you disable Transparent HugePages on any Linux database servers running Oracle.
  • HugePages follow a “use it or lose it” paradigm, so make sure that you optimize your usage of HugePages.
  • Automatic Memory Management (AMM) and HugePages are not compatible in Oracle 11g versions and later.

How to Solve the Oracle Error ORA-12154: TNS:could not resolve the connect identifier specified

The “ORA-12154: TNS Oracle error message is very common for database administrators. Learn how to diagnose & resolve this common issue here today.

Vijay Muthu | February 4, 2021

Data Types: The Importance of Choosing the Correct Data Type

Most DBAs have struggled with the pros and cons of choosing one data type over another. This blog post discusses different situations.

Craig Mullins | October 11, 2017

How to Recover a Table from an Oracle 12c RMAN Backup

Our database experts explain how to recover and restore a table from an Oracle 12c RMAN Backup with this step-by-step blog. Read more.

Megan Elphingstone | February 2, 2017

Subscribe to Our Blog

Never miss a post! Stay up to date with the latest database, application and analytics tips and news. Delivered in a handy bi-weekly update straight to your inbox. You can unsubscribe at any time.

Work with Us

Let’s have a conversation about what you need to succeed and how we can help get you there.

CONTACT US

Work for Us

Where do you want to take your career? Explore exciting opportunities to join our team.

EXPLORE JOBS