Configuring the IBM JVM for RTC, RSA and other Eclipse based IDE products

Overview

I have been surprised by how little RTC and RSA users know about customizing their environment. I have found with several development teams that increasing everyone’s familiarity with the eclipse.ini and possible configurations can have a surprising impact on productivity and reduction of downtime. In my experience, the number one cause of “Why is Eclipse so slow?” and “Why does Eclipse crash so much?” is a failure to scale the JVM settings to meet the actual demands.

A useful resource will be the IBM JVM defaults:

http://publib.boulder.ibm.com/infocenter/javasdk/v6r0/index.jsp?topic=%2Fcom.ibm.java.doc.diagnostics.60%2Fdiag%2Fappendixes%2Fdefaults.html

c – The setting is controlled by a command-line parameter only.
e – The setting is controlled by an environment variable only.
ec – The setting is controlled by a command-line parameter or an environment variable. The command-line parameter always takes precedence.

JVM setting AIX® IBM® i Linux Windows z/OS® Setting affected by
Default locale None None None N/A None e
Time to wait before starting plug-in N/A N/A Zero N/A N/A e
Temporary directory /tmp /tmp /tmp c:\temp /tmp e
Plug-in redirection None None None N/A None e
IM switching Disabled Disabled Disabled N/A Disabled e
IM modifiers Disabled Disabled Disabled N/A Disabled e
Thread model N/A N/A N/A N/A Native e
Initial stack size for Java™ Threads 32-bit. Use:-Xiss<size> 2 KB 2 KB 2 KB 2 KB 2 KB c
Maximum stack size for Java Threads 32-bit. Use:-Xss<size> 256 KB 256 KB 256 KB 256 KB 256 KB c
Stack size for OS Threads 32-bit. Use -Xmso<size> 256 KB 256 KB 256 KB 32 KB 256 KB c
Initial stack size for Java Threads 64-bit. Use:-Xiss<size> 2 KB N/A 2 KB 2 KB 2 KB c
Maximum stack size for Java Threads 64-bit. Use:-Xss<size> 512 KB N/A 512 KB 512 KB 512 KB c
Stack size for OS Threads 64-bit. Use -Xmso<size> 256 KB N/A 256 KB 256 KB 256 KB c
Initial heap size. Use -Xms<size> 4 MB 4 MB 4 MB 4 MB 4 MB c
Maximum Java heap size. Use -Xmx<size> Half the available memory with a minimum of 16 MB and a maximum of 512 MB 2 GB Half the available memory with a minimum of 16 MB and a maximum of 512 MB Half the real memory with a minimum of 16 MB and a maximum of 2 GB Half the available memory with a minimum of 16 MB and a maximum of 512 MB c

 

Note that on Linux by default a 32bit JVM will have a maximum heap size of 512MB

Before changing memory settings for RSA or RTC it is important to consider available RAM, IBM’s rule of thumb is that the total configured heap size of all java processes should not consume more than half of available RAM in order to allow sufficent RAM for the operating system itself as well as native memory allocation that may occur. For example, when using networking protocols the operating system and Java are probably allocating byte-buffers (per socket connection in the case of HTTP and other TCP connections). This is especially important to consider when configuring a server as you will see significantly higher memory consumption at the operating system level than what has been configured in Java using -Xmx etc.

Configuring Eclipse

Since both RTC and RSA are built on the Eclipse platform the configuration of the JVM is done via the eclipse.ini

My 4.0.3 test environment has this as an ini, which I think is the default:

-vm
C:\Users\work\usr\RTC_403_20130328\RTC\TeamConcert\jdk\jre\bin\javaw.exe
–launcher.XXMaxPermSize
256m
-startup
plugins/org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar
-install
C:\Users\work\usr\RTC_403_20130328\RTC\TeamConcert
–launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.2.R36x_v20101222
-vmargs
-Xms100m
-Xmx512m
-Dosgi.requiredJavaVersion=1.5
-Dosgi.bundlefile.limit=100

What we’re particularly interested in are the vmargs that configure memory: -Xmx and -Xms.\

-Xms
Sets the initial Java heap size.

-Xmx
Sets the maximum memory size for the application (-Xmx >= -Xms).

As you can see the defaults are quite small, even if you only have a 32bit machine with 3GB or 4GB of RAM you can easily run up to 1.5GB. You will find however that if you are running a 32 bit Windows environment that you are probably unable to set -Xmx much larger than 1580m. (But you may find that you are pushing the host to it’s limits, if you actually use that much memory.)

I almost always set -Xmx up to 1g to allow a maximum heap size of one gigabyte. However I have had a handful of plugin development environments that have required me to go up to 1580m to avoid running out of memory when resetting the plugin target to a new version of Eclipse.

Eclipse Heap Status

While running any Eclipse based IDE product you should have the Heap Status Monitor available. It can be enabled in General preferences by checking the “Show heap status” checkbox. With that setting enabled you can see the Java memory status. Hovering the mouse over the widget give you a tooltip with more info, clicking the garbage can icon forces a System.gc(). More options are available with a context menu. I’m a big fan of the ‘Show Max Heap’ option:

Quick review

  • 32 bit default heap size is quite small
  • in Eclipse this is controlled by command line vmargs in eclipse.ini
  • -Xmx1g and -Xmx1580m are good values even on a 32bit OS.
  • you can monitor the java heap in Eclipse by using the ‘Show heap status’ preference

Note that 64 bit versions of both RTC and RSA are available, but not for all versions. (I think 64 bit RTC is 4+ and RSA is 8+)

Other resources

IBM Java 1.6 documentation of memory settings:
http://publib.boulder.ibm.com/infocenter/javasdk/v6r0/index.jsp?topic=%2Fcom.ibm.java.doc.diagnostics.60%2Fdiag%2Fappendixes%2Fcmdline%2Fcommands_gc.html

http://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse%3F
http://wiki.eclipse.org/Eclipse.ini

The Eclipse 3.6 (Helios) command line documentation is here, any of the options listed here can be added to eclipse.ini
http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html

I also found a Stackoverflow question that has the most complete list of configuration issues I’ve ever seen though it was started some time ago and doesn’t address large heaps or 64 bit environments.
http://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse%3F

Leave a Reply