On Solaris, no OS configuration is required, and large pages are enabled by default.
If the UseLargePages flag is enabled on a system that does not support large pages, no warn-
ing is given and the JVM uses regular pages. If the UseLargePages flag is enabled on a sys-
tem that does support large pages, but for which no large pages are available (either because
they are already all in use or because the operating system is misconfigured), the JVM will
print a warning.
Linux huge (large) pages
Linux refers to large pages as huge pages. The configuration of huge pages on Linux varies
somewhat from release to release; for the most accurate instructions, consult the documenta-
tion for your release. But the general procedure for Linux 5 is this:
1. Determine which huge page sizes the kernel supports. The size is based on the com-
puter's processor and the boot parameters given when the kernel has started, but the
most common value is 2 MB:
# grep Hugepagesize /proc/meminfo
Hugepagesize: 2048 kB
2. Figure out how many huge pages are needed. If a JVM will allocate a 4 GB heap and
the system has 2 MB huge pages, 2,048 huge pages will be needed for that heap. The
number of huge pages that can be used is defined globally in the Linux kernel, so re-
peat this process for all the JVMs that will run (plus any other programs that will use
huge pages). You should overestimate this value by 10% to account for other nonheap
uses of huge pages (so the example here uses 2,200 huge pages).
3. Write out that value to the operating system (so it takes effect immediately):
# echo 2200 > /proc/sys/vm/nr_hugepages
4. Save that value in /etc/sysctl.conf so that it is preserved after rebooting: