-
Bug
-
Resolution: Fixed
-
P3
-
7
-
linux
In the document of "Java Support for Large Memory Pages", the following
description about how to enable large pages on Linux
is misleading:
- Increase SHMMAX value. It must be larger than the Java heap size.
For users who have to configure (or do sizing) OS kernel parameters
/proc/sys/kernel/shmmax and /proc/sys/vm/nr_hugepages, this description can
be incorrectly understood that Java process allocates large pages for only
Java Heap. However, according to my test, it allocated large pages for the
following 4 areas:
(1) Java Heap
(2) Perm Generation
(3) Code Cache
(4) a marking bitmap data structure for Parallel GC.
So, when nr_hugepages parameter is configured to the size of the Java Heap,
especially (2) and (3) can fail to be allocated on large pages because they
are quite large in size.
The document of "Java Support for Large Memory Pages" should provide correct
sizing guideline on Linux.
Document Location
=================
Linux configuration part in the document of "Java Support for Large Memory
Pages".
---
Linux:
Large page support is included in 2.6 kernel. Some vendors have backported
the code to their 2.4 based releases. To check if your system can support
large page memory, try the following:
# cat /proc/meminfo | grep Huge
HugePages_Total: 0
HugePages_Free: 0
Hugepagesize: 2048 kB
#
If the output shows the three "Huge" variables then your system can
support large page memory, but it needs to be configured. If the command
doesn't print out anything, then large page support is not available.
To configure the system to use large page memory, one must log in as root,
then:
- Increase SHMMAX value. It must be larger than the Java heap size. On a
system with 4 GB of physical RAM (or less) the following will make all
the memory sharable:
# echo 4294967295 > /proc/sys/kernel/shmmax
- Specify the number of large pages. In the following example 3 GB of a
4 GB system are reserved for large pages (assuming a large page size
of 2048k, then 3g = 3 x 1024m = 3072m = 3072 * 1024k = 3145728k, and
3145728k / 2048k = 1536):
# echo 1536 > /proc/sys/vm/nr_hugepages
Note the /proc values will reset after reboot so you may want to set them
in an init script (e.g. rc.local or sysctl.conf).
---
URL
===
http://www.oracle.com/technetwork/java/javase/tech/largememory-jsp-137182.html
description about how to enable large pages on Linux
is misleading:
- Increase SHMMAX value. It must be larger than the Java heap size.
For users who have to configure (or do sizing) OS kernel parameters
/proc/sys/kernel/shmmax and /proc/sys/vm/nr_hugepages, this description can
be incorrectly understood that Java process allocates large pages for only
Java Heap. However, according to my test, it allocated large pages for the
following 4 areas:
(1) Java Heap
(2) Perm Generation
(3) Code Cache
(4) a marking bitmap data structure for Parallel GC.
So, when nr_hugepages parameter is configured to the size of the Java Heap,
especially (2) and (3) can fail to be allocated on large pages because they
are quite large in size.
The document of "Java Support for Large Memory Pages" should provide correct
sizing guideline on Linux.
Document Location
=================
Linux configuration part in the document of "Java Support for Large Memory
Pages".
---
Linux:
Large page support is included in 2.6 kernel. Some vendors have backported
the code to their 2.4 based releases. To check if your system can support
large page memory, try the following:
# cat /proc/meminfo | grep Huge
HugePages_Total: 0
HugePages_Free: 0
Hugepagesize: 2048 kB
#
If the output shows the three "Huge" variables then your system can
support large page memory, but it needs to be configured. If the command
doesn't print out anything, then large page support is not available.
To configure the system to use large page memory, one must log in as root,
then:
- Increase SHMMAX value. It must be larger than the Java heap size. On a
system with 4 GB of physical RAM (or less) the following will make all
the memory sharable:
# echo 4294967295 > /proc/sys/kernel/shmmax
- Specify the number of large pages. In the following example 3 GB of a
4 GB system are reserved for large pages (assuming a large page size
of 2048k, then 3g = 3 x 1024m = 3072m = 3072 * 1024k = 3145728k, and
3145728k / 2048k = 1536):
# echo 1536 > /proc/sys/vm/nr_hugepages
Note the /proc values will reset after reboot so you may want to set them
in an init script (e.g. rc.local or sysctl.conf).
---
URL
===
http://www.oracle.com/technetwork/java/javase/tech/largememory-jsp-137182.html