Skip navigation.
Downloads | Product Documentation | Support

Tuning the JRockit JVM

# Basic Tuning Tips and Techniques

When you install BEA JRockit JVM, it includes a host of default start-up options that ensure a satisfactory out-of-the-box experience; however, sometimes, these options might not provide your application with the optimal performance. Therefore, BEA JRockit JVM comes with numerous alternative options and algorithms to suit different applications. This section describes some of these options and some basic tuning techniques you can use at startup. You find information on the following subjects:

- Determine What You Want to Tune For
- Set the Heap Size
- Tune the JVM
- Analyze the Performance by Using the JRA

# Determine What You Want to Tune For

Before you start BEA JRockit JVM, you need to determine these two factors:

- How much of your system memory do you prefer that the BEA JRockit JVM uses?
- What do you want from BEA JRockit JVM, the highest possible responsiveness or the highest possible performance?

Once you've answered these questions, use the information provided below to tune BEA JRockit JVM to achieve those goals.

# Set the Heap Size

Generally, you want to set the maximum heap size as high as possible, but not so high that it causes page faults for the application or for some other application on the same computer. Heap sizing is accomplished by using the `-Xms` (minimum heap size) and `-Xmx` (maximum heap size) options. For details on these options and guidelines for sizing the heap, please refer to Setting the Heap Size.

# Tune the JVM

As mentioned above, you need to consider how you want JRockit to perform: for the highest possible responsiveness or the highest possible performance? This section describes how to tune for either type of performance.

## Tuning for High Responsiveness

If you want the highest responsiveness from your application and guarantee minimal pause times, do the following:

- Select a garbage collector that suits your application the best:

- Use the default dynamic garbage collector (`-Xgcprio`) and set a pause time (`-Xgcprio:pausetime`).

When you use the option `-Xgcprio:pausetime`, you can also set a target time for the pauses (`-Xpausetarget`). That way JRockit tries to adapt the pause times to the length that you specify. If you do not set the option to a specific time, the default value is used (500ms). This is an example of how you can set the pause target:

`-Xgcprio:pausetime` `-Xpausetarget=400ms`

OR

- Use a fixed garbage collector, select the Generational Concurrent garbage collector (`-Xgc:gencon`).

- Set the initial (`-Xms`) and maximum (`-Xmx`) heap sizes, as described in Setting the Heap Size. If you're using a fixed, generational concurrent garbage collector, a larger heap reduces the frequency of garbage collection. This will prevent longer pauses.
- Set the size of the nursery (`-Xns`). If the application is creating a lot of temporary objects, you should use a large nursery, to reduce old collection frequency. Larger nurseries usually result in slightly longer pauses, so, while you should try to make the nursery as large as possible, don't make it so large that pause times become unacceptable.

You can see the nursery pause times in BEA JRockit JVM by starting the JVM with`-Xgcpause`.

## Tuning for High Performance

If you want the highest possible performance BEA JRockit can provide, you will want to optimize for application thoughput. Set these tuning options at startup:

- Select a garbage collector that suits your application best:

- Use the default dynamic garbage collector with the throughput priority specified (`-Xgcprio:throughput`)

OR

- Select the parallel (`-Xgc:parallel`) garbage collector. The parallel garbage collector doesn't use a nursery, so you don't need to set -`Xns`.

- Set the largest initial (`-Xms`) and maximum (`-Xmx`) heap sizes that your system can tolerate, as described in Set the Heap Size (not valid for the parallel garbage collector).

## Analyze the Performance by Using the JRA

The JRockit Runtime Analyzer (JRA) is a great way to look at the performance of JRockit. The JRA records what happens in your system in runtime and then saves the findings in a file that can be analyzed through a separate JRA tool. The recording contains information about, for example, memory usage, Java heap content, and hot methods. For information on how to use the JRA, see:

Using the JRockit Runtime Analyzer