Select Page

HugePages Setup for Linux

Datavail | | 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.

12c Upgrade Bug with SQL Tuning Advisor

This blog post outlines steps to take on Oracle upgrade 11.2 to 12.1 if you’re having performance problems. Oracle offers a patch and work around to BUG 20540751.

Megan Elphingstone | March 22, 2017

Tips for Upgrading From SQL 2008 to 2012 or 2014

It’s 2015 and you can now establish totally respectable MS SQL DBA credibility just by mentioning you have been in the game since SQL Server version 9. You may even get the same gasps of shock from some colleagues that used to be reserved for the version 6 veterans.

Andy McDermid | April 8, 2015
code

Recover a Table from an RMAN Backup in an Oracle 12c

This blog post will is to show a table restore for one table in a container database

Megan Elphingstone | February 2, 2017

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