In this article, we will show you how to test:
- if your Linux system supports large page
- if your Linux system is configured correctly for large page support
How to Test If Large Page Is Supported?
To check if your system can support large page memory, try the following:
$ cat /proc/meminfo | grep Huge
Below we show the test results of three systems: System 1
$ cat /proc/meminfo | grep Huge
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
System 1 supports large page memory. However, it was not configured to use it. Note that large page size is in 2MB instead of the standard 4KB.
System 2
$ cat /proc/meminfo | grep Huge
$ System 2 does not support large page memory.
System 3
$ cat /proc/meminfo | grep Huge
HugePages_Total: 4000
HugePages_Free: 4000
HugePages_Rsvd: 0
Hugepagesize: 2048 kB
System 3 supports large page memory and it is configured to support up to 8GB.
How to Test If Large Page Is Configured Correctly?
- -XX:+UseLargePages (on by default for Solaris, off by default for Windows and Linux).
It is a good idea to verify that the large-page configuration in your system is correct by running this command:
$java -Xmx400m -XX:+UseLargePages -version
Test 1
$java -Xmx400m -XX:+UseLargePages -version
Java HotSpot(TM) Server VM warning: Failed to reserve shared memory (errno = 12).
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)Java HotSpot(TM) Server VM (build 11.0-b16, mixed mode)
Test 1 was run on System 1 which supports large page, but is not configured for its use.
Test 2
$ java -Xmx400m -XX:+UseLargePages -version
Java HotSpot(TM) Server VM warning: Failed to reserve shared memory (errno = 38).
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) Server VM (build 20.4-b02, mixed mode)
Test 2 was run on System 2 which doesn't support large page.
Test 3
$ ./java -Xmx400m -XX:+UseLargePages -version
java version "1.6.0_29"
Java(TM) SE Runtime Environment (build 1.6.0_29-b11)
Java HotSpot(TM) Server VM (build 20.4-b02, mixed mode)
Test 3 was run on System 3 which supports large page and is configured to use it.
Conclusion
- if your system supports large page or not
- if your system is configured correctly for large page
Two final tips:
- To learn how to configure large page support on your Linux system, read [1].
- To request large memory pages on JRockit, you can use the following VM options[4]:
- -XlargePages
- -XlargePages:exitOnFailure
- -XX:+|-UseLargePagesFor[Heap|Code]
- Recommended by Oracle
References
- Java SE Tuning Tip: Large Pages on Windows and Linux
- Understanding Garbage Collection
- Java Tuning White Paper
- Oracle® JRockit Command-Line Reference
- Memlock limit too small (one of the requirements for large page support)
- JRockit: Could not acquire large pages for 2Mbytes code
- JRockit: Unable to open temporary file /mnt/hugepages/jrock8SadIG
- Oracle Fusion Middleware 11g SOA White Paper February 2013 (Check out "Huge pages" for the instructions of enabling huge pages on Linux kernel 2.6)
- huge page - The Linux Kernel Archives
No comments:
Post a Comment