Calculator for Linux Huge Page Table Config for Java JVMs

You can speedup Java processes that handle a big heap (several gigabytes) by configuring Linux and the JVM to use large memory pages. This minimizes the load on the TLB tables (which can hold only a limited number of entries) of the processor. For applications that don't have localized memory structures you can easily see a speedup of 50-100% because of the trashing of the TLB caches! But the speedup depends on the type of application you are running of course. The feature gets enabled by adding -XX:+UseLargePages (for BEA JRockit it's -XXlargePages, and for IBM's JVM it's -lp) to the JVMs commandline.
One disadvantage is there unfortunately: the memory you dedicate to the large page TLBs is not available to other Linux applications. It is also not available as filesystem cache even when it is not used! So you should set the values carefully to the values you really need for your Java application.

To use the large pages on Linux you have to do some simple calculations. To ease this calculations even more I have developed a simple calculator in Javascript which do you see at the bottom of the page.

Further readings:

Huge TLB Page Size (see grep Hugepagesize /proc/meminfo):

Memory you want to dedicate to hugepage TLBs:

Values that need to be added to /etc/sysctl.conf:

Values that needed to be added to /etc/security/limits.conf:

The user you start the Java application with must be member of the "hugetlb group" of course! You can create this group by groupadd hugetlb. The GID to insert into sysctl you get with grep hugetlb /etc/groups. To add an existing user to this group you can use usermod -a -G hugetlb . You need to relogin afterwards.