Guidelines for JVM (OpenJ9)

Suggested Parameters for OpenJ9

  • j9vm_minFreeHeap

  • j9vm_maxFreeHeap

  • j9vm_minHeapSize

  • j9vm_maxHeapSize

  • j9vm_gcCompact

  • j9vm_gcThreads

  • j9vm_gcPolicy

  • j9vm_codeCacheTotal

  • j9vm_compilationThreads

  • j9vm_aggressiveOpts

The following describes how to approach tuning JVM in the following areas:

Tuning JVM Heap

The most relevant JVM parameters are the ones defining the boundaries of the allocated heap (j9vm_minHeapSize, j9vm_maxHeapSize). The upper bound to configure for this domain strongly depends on the memory in megabytes available on the host instance or on how much we are willing to allocate, while the lower bound depends on the minimum requirements to run the application.

The free heap parameters (j9vm_minFreeHeap, j9vm_maxFreeHeap) define some boundaries for the free space target ratio, which impacts the trigger thresholds of the garbage collector. The suggested starting ranges are from 0.1 and 0.6 for the minimum free ratio range, and from 0.3 to 0.9 for the maximum.

The following represents a sample snippet of the section parametersSelection in the study definition:

parametersSelection:
  - name: jvm.j9vm_maxHeapSize
    domain: [<LOWER_BOUND>, <UPPER_BOUND>]
  - name: jvm.j9vm_minHeapSize
    domain: [<LOWER_BOUND>, <UPPER_BOUND>]

  - name: jvm.j9vm_minFreeHeap
    domain: [0.1, 0.6]
  - name: jvm.j9vm_maxFreeHeap
    domain: [0.3, 0.9]

It is also recommended to define the following constraints:

  • min heap size lower than or equal to the max heap size:

jvm.j9vm_minHeapSize <= jvm.j9vm_maxHeapSize
  • upper bound to be at least 5 percentage points higher than the lower bound

jvm.j9vm_minFreeHeap + 0.05 < jvm.j9vm_maxFreeHeap

Tuning JVM Garbage Collection

The following JVM parameters define the behavior of the garbage collector:

  • j9vm_gcPolicy

  • j9vm_gcThreads

  • j9vm_gcCompact

The garbage collection policy (j9vm_gcPolicy) defines the collection strategy used by the JVM. This parameter is key for the performance of the application: the default garbage collector (gencon) is the best solution for most scenarios, but some specific kinds of applications may benefit from one of the alternative options.

The number of GC threads (j9vm_gcThreads) defines the level of parallelism available to the collector. This value can range from 1 to the maximum number of CPUs that are available or we are willing to allocate.

The GC compaction (j9vm_gcCompact) selects if garbage collections perform full compactions always, never, or based on internal policies.

The following represents a sample snippet of the section parametersSelection in the study definition:

parametersSelection:
  - name: jvm.j9vm_gcPolicy
    categories: [balanced, gencon, metronome, optavgpause, optthruput]

  - name: jvm.j9vm_gcThreads
    domain: [1, <MAX_CPUS>]

  - name: jvm.j9vm_gcCompact

Tuning JVM compilation

The following JVM parameters define the behaviors of the compilation:

  • j9vm_compilationThreads

  • j9vm_codeCacheTotal

The compilation threads parameter (j9vm_compilationThreads) defines the number available for the JIT compiler. Its range depends on the available CPUs.

The code cache parameter (j9vm_codeCacheTotal) defines the maximum size limit for the JIT code cache. Higher values may benefit complex server-type applications, at the expense of the memory footprint, so should be taken into account in the overall memory requirements.

The following represents a sample snippet of the section parametersSelection in the study definition:

parametersSelection:
  - name: jvm.j9vm_compilationThreads
    domain: [1, <MAX_CPUS>]

  - name: jvm.j9vm_codeCacheTotal
    domain: [2, <UPPER_BOUND>]

Tuning JVM aggressive optimizations

The following JVM parameter defines the behavior of aggressive optimization:

  • j9vm_aggressiveOpts

Aggressive optimizations (j9vm_aggressiveOpts) enables some experimental features that usually lead to performance gains.

The following represents a sample snippet of the section parametersSelection in the study definition:

parametersSelection:
  - name: j9vm_aggressiveOpts

Last updated