Computer memory is allocated to processes as pages. Usually these pages are rather small, meaning that a process consuming a lot of memory will also be consuming a lot of pages. Searching through a multitude of pages can result in system slow downs, which is why some servers can benefit from enabling huge pages.
Huge pages is especially useful on systems like database servers. Processes like MySQL and PostgreSQL can make use of huge pages if they are enabled, and will put less strain on your RAM cache. In this tutorial, we will cover the step by step instructions to enable huge pages on a Linux system.
In this tutorial you will learn:
- How to view currently configured huge pages values
- How to enable huge pages on Linux

Category | Requirements, Conventions or Software Version Used |
---|---|
System | Any Linux distro |
Software | N/A |
Other | Privileged access to your Linux system as root or via the sudo command. |
Conventions |
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command$ – requires given linux commands to be executed as a regular non-privileged user |
How to enable huge pages on Linux step by step instructions
Most modern CPU architectures support bigger memory pages. Linux calls them Huge Pages, BSD calls them Super Pages, and Windows calls them Large Pages. As you can see, all operating systems feature support for the increased memory pages, but they all call them something different.
- Open a terminal and run the following command. This will allow you to see if your kernel supports huge pages (if you get any output, it is supported) and will also show you the currently configured huge pages settings.
$ grep Huge /proc/meminfo
Most likely, your huge page size will be configured to 2 MB, which is the standard on modern systems.
Checking huge page values on a Linux system - Once you know how large you would like your page size to be, we can use the following command to change it. We will take a conservative approach in this example and change our page size to 100 MB. On most production servers, your value would likely be much larger.
$ sudo sysctl -w vm.nr_hugepages=102400
- To ensure that the change stays persistent across future reboots, we will also need to add this configuration to the
/etc/sysctl.conf
file.vm.nr_hugepages = 102400
Open the
/etc/sysctl.conf
file with root permissions and add the line to it manually.Adding our huge pages configuration to the sysctl.conf file - Reboot for these changes to take effect.
$ reboot
- Once again, check your system’s allocation of huge pages in the
/proc/meminfo
virtual file. You should see some different values this time.$ grep Huge /proc/meminfo
Huge pages has been enabled on our Linux system
Closing Thoughts
In this tutorial, you saw how to enable huge pages on a Linux system. Certain types of servers, such as database servers, will benefit from having a bigger page table. It is recommended to thoroughly test this setup before rolling it into production, as it could have unexpected effects on certain components of your system.