A dozen IBM JVM arguments to cut & paste
timdp 2000003V97 Comment (1) Visits (17625)
Here are 13 (it's a bakers dozen) useful command-line options for the IBM Java virtual machine. They're presented here for you in a format that is easy to cut & paste and in no particular order. Unless specified, all options are for the Java 6 virtual machine.
Enable verbose garbage collection output. This output can be loaded into the (superb) Garbage Collection and Memory Visualiser in the IBM Support Assistant to analyse garbage collector performance. The -Xverbosegclog line above specifies a date/time stamped file to write to (default behaviour is write to stderr), and configures a rolling log with 5 files, each containing 20000 entries.
-Xgcpolicy:gencon -Xmn<x> -Xmo<y> -Xms<z> -Xmx<z>
Enable the generational concurrent garbage collection policy. The (excellent) Java Diagnostics Guide says "A generational garbage collection strategy is well suited to an application that creates many short-lived objects, as is typical of many transactional applications.", in my experience this policy when correctly tuned can provide a good throughput boost to most Java applications. With gencon, the heap is split into two areas, so as well as the well known -Xms and -Xmx parameters there are parameters to control the size of the tenured space (-Xmo) and nursery space (-Xmn). For more advanced scenarios, you can specify both minimum and maximum for either the tenured space (-Xmos and -Xmox) and nursery space (-Xmns and -Xmnx).
Turns System.gc() into a no-op. Useful when the Garbage Collection and Memory Visualiser tool is telling you that someone is calling System.gc() and you (quite rightly) want to prevent this impacting your application. Remember, the VM is much smarter than you are when it comes to determining when to trigger garbage collection.
Disables compaction on System.gc() so that compaction only occurs when the compaction triggers are met. If you have classes which call System.gc() (or you're using RMI) this can help to minimise the impact. This option is useless if you're using -Xdi
Specifies a method trace that will generate a stack trace to the console whenever System.gc() is called. The numerical arguments in the trigger state that a stack trace will be generated from the fifth occurrence of System.gc() and for the next ten invocations. Use this syntax when you want to find out who has been calling System.gc() or vary the method and action to suit your needs.
Prevents excessive garbage collection caused when using RMI for Java versions prior to Java 6.0. Garbage collection is important when using RMI to ensure the clearance of reference objects, but this is done with a System.gc(), which forces compaction, and the defaults intervals prior to Java 6 are unrealistically short. The values above set the intervals to hourly, which is the same as the default behaviour on Java 6.
Configures a dump agent which generates a core dump when the JVM receives a SIGQUIT signal (kill -3). The request options ensure that unreachable objects are removed from the heap, and that the heap will be usable with IBM's (brilliant) Memory Analysis Tool. Make sure you have your ulimits set appropriately and ff you're running on AIX ensure you enable full core dumps if you are working with large heaps. Also, core dumps need to be processed with jextract which can be found in the jre/bin directory before they can be loaded into the Memory Analysis Tool.
Configures a dump agent which generates a core dump when the JVM encounters and OutOfMemoryError exception.
Modify the default SIGQUIT (kill -3) behaviour of the IBM JVM to more closely match Sun JVM behaviour. By default, the IBM JVM produces a highly useful javacore on receipt of a SIGQUIT, the option above generates a basic stack dump for the current thread into a named file. I don't see the point of this one personally (javacores are awesome), but I have been asked how to achieve this so here's the method.
Prints out the configuration of all enabled dump agents. -Xdump flags are processed left to right, so make sure this is the last one on the command line!
Enable the IBM Health Center agent on a given port. If you're using a version prior to Java 5 SR 9 or Java 6 SR 5, the syntax is a little different. Specifying a port is useful when you are running more than one VM on a single box as the default behaviour is to enumerate ports starting from 1972.
Outputs the various heap and stack sizes in use by the JVM on startup. Very useful when you're capturing a number of runs that you plan to compare.
If you are using Java 6 on a 64 bit operating system, you should definitely be using this flag. This enables compressed references, which makes the JVM store all all references as 32 bit values, often delivering a performance increase over the previous JVM versions on 64 bit architectures. There is a limit of 25 GB maximum heap size when using compressed references.