JVM - Large Memory Pages

  • 7011143
  • 08-Mar-2012
  • 19-Oct-2012


Large Memory Pages -XX:+UseLargePages

Using large memory pages has a dramatic positive impact on memory allocation as well as time spent in GC. Since Access Governance Suite can grow the heap to multiple gigabytes using large memory pages can speed up certain processes such as analytics significantly.

Large memory pages must be enabled and configured on the OS. Below are example steps on configuring this support within Linux setting up a maximum reserve space of 48GB and a JVM with Xms8192 and Xmx16384. In our example the user running the JVM with large memory page support is 'apache' and the group with access to the memory space is 'hugetbl'.

Start by editing the /etc/security/limits.conf, here the count is expressed in kilobytes. Add the following two entries.

apache soft memlock 50331648
apache hard memlock 50331648

Edit /etc/sysctl.conf, here we assume that each large memory page is 2048Kb. We also assume that the hugetbl GID is 502. The value for shmmax and shmall is expressed in bytes.

vm.hugetlb_shm_group = 502
vm.nr_hugepages = 24576
kernel.shmmax = 51539607552
kernel.shmall = 51539607552

Create the hugetbl group and add the apache user to it, validate it by using the following getent commands:

getent passwd
getent group

The changes can be put into affect by executing 'sysctl -p', however it's best to reboot the system so that the memory pages can be allocated contigiously.

Alter the JVM to use large pages by adding 'XX:+UseLargePages' and 'XX:LargePageSizeInBytes=2m'

Startup your JVM, and then look at the /proc/meminfo file. If the values for HugePages_Free is less than HugePages_Total, than the JVM is using large memory pages.

HugePages_Total: 24576
HugePages_Free: 23234
HugePages_Rsvd: 7267
Hugepagesize: 2048 kB

Feedback service temporarily unavailable. For content questions or problems, please contact Support.