# Java OpenJDK 11

This page describes the Optimization Pack for Java OpenJDK 11 JVM.

## Metrics

### Memory

<table><thead><tr><th width="318.3333333333333">Metric</th><th width="127">Unit</th><th>Description</th></tr></thead><tbody><tr><td>mem_used</td><td>bytes</td><td>The total amount of memory used</td></tr><tr><td>requests_throughput</td><td>requests/s</td><td>The number of requests performed per second</td></tr><tr><td>requests_response_time</td><td>milliseconds</td><td>The average request response time</td></tr><tr><td>jvm_heap_size</td><td>bytes</td><td>The size of the JVM heap memory</td></tr><tr><td>jvm_heap_used</td><td>bytes</td><td>The amount of heap memory used</td></tr><tr><td>jvm_heap_util</td><td>percent</td><td>The utilization % of heap memory</td></tr><tr><td>jvm_memory_used</td><td>bytes</td><td>The total amount of memory used across all the JVM memory pools</td></tr><tr><td>jvm_memory_used_details</td><td>bytes</td><td>The total amount of memory used broken down by pool (e.g., code-cache, compressed-class-space)</td></tr><tr><td>jvm_memory_buffer_pool_used</td><td>bytes</td><td>The total amount bytes used by buffers within the JVM buffer memory pool</td></tr></tbody></table>

### CPU

<table><thead><tr><th width="155.33333333333331">Metric</th><th width="112">Unit</th><th>Description</th></tr></thead><tbody><tr><td>cpu_util</td><td>percent</td><td>The average CPU utilization % across all the CPUs (i.e., how much time on average the CPUs are busy doing work)</td></tr><tr><td>cpu_used</td><td>CPUs</td><td>The total amount of CPUs used</td></tr></tbody></table>

### Garbage Collection

<table><thead><tr><th width="232.33333333333331">Metric</th><th width="130">Unit</th><th>Description</th></tr></thead><tbody><tr><td>jvm_gc_time</td><td>percent</td><td>The % of wall clock time the JVM spent doing stop the world garbage collection activities</td></tr><tr><td>jvm_gc_time_details</td><td>percent</td><td>The % of wall clock time the JVM spent doing stop the world garbage collection activities broken down by type of garbage collection algorithm (e.g., ParNew)</td></tr><tr><td>jvm_gc_count</td><td>collections/s</td><td>The total number of stop the world JVM garbage collections that have occurred per second</td></tr><tr><td>jvm_gc_count_details</td><td>collections/s</td><td>The total number of stop the world JVM garbage collections that have occurred per second, broken down by type of garbage collection algorithm (e.g., G1, CMS)</td></tr><tr><td>jvm_gc_duration</td><td>seconds</td><td>The average duration of a stop the world JVM garbage collection</td></tr><tr><td>jvm_gc_duration_details</td><td>seconds</td><td>The average duration of a stop the world JVM garbage collection broken down by type of garbage collection algorithm (e.g., G1, CMS)</td></tr></tbody></table>

### Other metrics

<table><thead><tr><th width="252">Metric</th><th width="134.33333333333331">Unit</th><th>Description</th></tr></thead><tbody><tr><td>jvm_threads_current</td><td>threads</td><td>The total number of active threads within the JVM</td></tr><tr><td>jvm_threads_deadlocked</td><td>threads</td><td>The total number of deadlocked threads within the JVM</td></tr><tr><td>jvm_compilation_time</td><td>milliseconds</td><td>The total time spent by the JVM JIT compiler compiling bytecode</td></tr></tbody></table>

## Parameters

### Memory

<table><thead><tr><th width="198">Name</th><th width="113">Type</th><th>Unit</th><th width="140">Dafault</th><th>Domain</th><th>Restart</th><th>Description</th></tr></thead><tbody><tr><td>jvm_minHeapSize</td><td>integer</td><td>megabytes</td><td>You should select your own default value.</td><td>You should select your own domain.</td><td>yes</td><td>The inimum heap size.</td></tr><tr><td>jvm_maxHeapSize</td><td>integer</td><td>megabytes</td><td>You should select your own default value.</td><td>You should select your own domain.</td><td>yes</td><td>The maximum heap size.</td></tr><tr><td>jvm_maxRAM</td><td>integer</td><td>megabytes</td><td>You should select your own default value.</td><td>You should select your own domain.</td><td>yes</td><td>The maximum amount of memory used by the JVM.</td></tr><tr><td>jvm_initialRAMPercentage</td><td>real</td><td>percent</td><td><code>1.563</code></td><td><code>0.1</code> → <code>100</code></td><td>yes</td><td>The initial percentage of memory used by the JVM.</td></tr><tr><td>jvm_maxRAMPercentage</td><td>real</td><td>percent</td><td><code>25.0</code></td><td><code>0.1</code> → <code>100.0</code></td><td>yes</td><td>The percentage of memory used for maximum heap size. Requires Java 10, Java 8 Update 191 or later.</td></tr><tr><td>jvm_alwaysPreTouch</td><td>categorical</td><td> </td><td><code>-AlwaysPreTouch</code></td><td><code>+AlwaysPreTouch</code>, <code>-AlwaysPreTouch</code></td><td>yes</td><td>Pretouch pages during initialization.</td></tr><tr><td>jvm_metaspaceSize</td><td>integer</td><td>megabytes</td><td><code>20</code></td><td>You should select your own domain.</td><td>yes</td><td>The initial size of the allocated class metadata space.</td></tr><tr><td>jvm_maxMetaspaceSize</td><td>integer</td><td>megabytes</td><td><code>20</code></td><td>You should select your own domain.</td><td>yes</td><td>The maximum size of the allocated class metadata space.</td></tr><tr><td>jvm_useTransparentHugePages</td><td>categorical</td><td> </td><td><code>-UseTransparentHugePages</code></td><td><code>+UseTransparentHugePages</code>, <code>-UseTransparentHugePages</code></td><td>yes</td><td>Enables the use of large pages that can dynamically grow or shrink.</td></tr><tr><td>jvm_allocatePrefetchInstr</td><td>integer</td><td> </td><td><code>0</code></td><td><code>0</code> → <code>3</code></td><td>yes</td><td>Prefetch ahead of the allocation pointer.</td></tr><tr><td>jvm_allocatePrefetchDistance</td><td>integer</td><td>bytes</td><td><code>0</code></td><td><code>0</code> → <code>512</code></td><td>yes</td><td>Distance to prefetch ahead of allocation pointer. -1 use system-specific value (automatically determined).</td></tr><tr><td>jvm_allocatePrefetchLines</td><td>integer</td><td>lines</td><td><code>3</code></td><td><code>1</code> → <code>64</code></td><td>yes</td><td>The number of lines to prefetch ahead of array allocation pointer.</td></tr><tr><td>jvm_allocatePrefetchStyle</td><td>integer</td><td> </td><td><code>1</code></td><td><code>0</code> → <code>3</code></td><td>yes</td><td>Selects the prefetch instruction to generate.</td></tr><tr><td>jvm_useLargePages</td><td>categorical</td><td> </td><td><code>+UseLargePages</code></td><td><code>+UseLargePages</code>, <code>-UseLargePages</code></td><td>yes</td><td>Enable the use of large page memory.</td></tr><tr><td>jvm_aggressiveHeap</td><td>categorical</td><td></td><td><code>-AggressiveHeap</code></td><td><code>-AggressiveHeap</code>, <code>+AggressiveHeap</code></td><td>yes</td><td>Optimize heap options for long-running memory intensive apps.</td></tr></tbody></table>

### Garbage Collection

<table><thead><tr><th width="166">Name</th><th>Type</th><th>Unit</th><th>Default</th><th>Domain</th><th>Restart</th><th width="431">Description</th></tr></thead><tbody><tr><td>jvm_newSize</td><td>integer</td><td>megabytes</td><td>You should select your own default value.</td><td>You should select your own domain.</td><td>yes</td><td>Sets the initial and maximum size of the heap for the young generation (nursery).</td></tr><tr><td>jvm_maxNewSize</td><td>integer</td><td>megabytes</td><td>You should select your own default value.</td><td>You should select your own domain.</td><td>yes</td><td>Specifies the upper bound for the young generation size.</td></tr><tr><td>jvm_survivorRatio</td><td>integer</td><td> </td><td><code>8</code></td><td><code>1</code> → <code>100</code></td><td>yes</td><td>The ratio between the Eden and each Survivor-space within the JVM. For example, a jvm_survivorRatio would mean that the Eden-space is 6 times one Survivor-space.</td></tr><tr><td>jvm_useAdaptiveSizePolicy</td><td>categorical</td><td> </td><td><code>+UseAdaptiveSizePolicy</code></td><td><code>+UseAdaptiveSizePolicy</code>, <code>-UseAdaptiveSizePolicy</code></td><td>yes</td><td>Enable adaptive generation sizing. Disable coupled with jvm_targetSurvivorRatio.</td></tr><tr><td>jvm_adaptiveSizePolicyWeight</td><td>integer</td><td>percent</td><td><code>10</code></td><td><code>1 → 100</code></td><td>yes</td><td>The weighting given to the current Garbage Collection time versus previous GC times when checking the timing goal.</td></tr><tr><td>jvm_targetSurvivorRatio</td><td>integer</td><td> </td><td><code>50</code></td><td><code>1</code> → <code>100</code></td><td>yes</td><td>The desired percentage of Survivor-space used after young garbage collection.</td></tr><tr><td>jvm_minHeapFreeRatio</td><td>integer</td><td>percent</td><td><code>40</code></td><td><code>1</code> → <code>99</code></td><td>yes</td><td>The minimum percentage of heap free after garbage collection to avoid shrinking.</td></tr><tr><td>jvm_maxHeapFreeRatio</td><td>integer</td><td>percent</td><td><code>70</code></td><td><code>1</code> → <code>100</code></td><td>yes</td><td>The maximum percentage of heap free after garbage collection to avoid shrinking.</td></tr><tr><td>jvm_maxTenuringThreshold</td><td>integer</td><td> </td><td><code>15</code></td><td><code>0</code> → <code>15</code></td><td>yes</td><td>The maximum value for the tenuring threshold.</td></tr><tr><td>jvm_gcType</td><td>categorical</td><td> </td><td><code>Parallel</code></td><td><code>Serial</code>, <code>Parallel</code>, <code>ConcMarkSweep</code>, <code>G1</code></td><td>yes</td><td>Type of the garbage collection algorithm.</td></tr><tr><td>jvm_useParallelOldGC</td><td>categorical</td><td> </td><td><code>-UseParallelOldGC</code></td><td><code>+UseParallelOldGC</code>, <code>-UseParallelOldGC</code></td><td>yes</td><td>Enables Parallel Mark and Compact Garbage Collection in Old/Tenured generations.</td></tr><tr><td>jvm_concurrentGCThreads</td><td>integer</td><td>threads</td><td>You should select your own default value.</td><td>You should select your own domain.</td><td>yes</td><td>The number of threads concurrent garbage collection will use.</td></tr><tr><td>jvm_parallelGCThreads</td><td>integer</td><td>threads</td><td>You should select your own default value.</td><td>You should select your own domain.</td><td>yes</td><td>The number of threads garbage collection will use for parallel phases.</td></tr><tr><td>jvm_maxGCPauseMillis</td><td>integer</td><td>milliseconds</td><td><code>200</code></td><td><code>1</code> → <code>32767</code></td><td>yes</td><td>Adaptive size policy maximum GC pause time goal in millisecond.</td></tr><tr><td>jvm_resizePLAB</td><td>categorical</td><td> </td><td><code>+ResizePLAB</code></td><td><code>+ResizePLAB</code>, <code>-ResizePLAB</code></td><td>yes</td><td>Enables the dynamic resizing of promotion LABs.</td></tr><tr><td>jvm_GCTimeRatio</td><td>integer</td><td> </td><td><code>99</code></td><td><code>0</code> → <code>100</code></td><td>yes</td><td>The target fraction of time that can be spent in garbage collection before increasing the heap, computet as 1 / (1 + GCTimeRatio).</td></tr><tr><td>jvm_initiatingHeapOccupancyPercent</td><td>integer</td><td> </td><td><code>45</code></td><td><code>0</code> → <code>100</code></td><td>yes</td><td>Sets the percentage of the heap occupancy at which to start a concurrent GC cycle.</td></tr><tr><td>jvm_youngGenerationSizeIncrement</td><td>integer</td><td>percent</td><td><code>20</code></td><td><code>0</code> → <code>100</code></td><td>yes</td><td>The increment size for Young Generation adaptive resizing.</td></tr><tr><td>jvm_tenuredGenerationSizeIncrement</td><td>integer</td><td>percent</td><td><code>20</code></td><td><code>0</code> → <code>100</code></td><td>yes</td><td>The increment size for Old/Tenured Generation adaptive resizing.</td></tr><tr><td>jvm_adaptiveSizeDecrementScaleFactor</td><td>integer</td><td>percent</td><td><code>4</code></td><td><code>1</code> → <code>1024</code></td><td>yes</td><td>Specifies the scale factor for goal-driven generation resizing.</td></tr><tr><td>jvm_CMSTriggerRatio</td><td>integer</td><td> </td><td><code>80</code></td><td><code>0</code> → <code>100</code></td><td>yes</td><td>The percentage of MinHeapFreeRatio allocated before CMS GC starts</td></tr><tr><td>jvm_CMSInitiatingOccupancyFraction</td><td>integer</td><td> </td><td><code>-1</code></td><td><code>-1</code> → <code>99</code></td><td>yes</td><td>Configure oldgen occupancy fraction threshold for CMS GC. Negative values default to CMSTriggerRatio.</td></tr><tr><td>jvm_CMSClassUnloadingEnabled</td><td>categorical</td><td> </td><td><code>+CMSClassUnloadingEnabled</code></td><td><code>+CMSClassUnloadingEnabled</code>, <code>-CMSClassUnloadingEnabled</code></td><td>yes</td><td>Enables class unloading when using CMS.</td></tr><tr><td>jvm_useCMSInitiatingOccupancyOnly</td><td>categorical</td><td> </td><td><code>-UseCMSInitiatingOccupancyOnly</code></td><td><code>+UseCMSInitiatingOccupancyOnly</code>, <code>-UseCMSInitiatingOccupancyOnly</code></td><td>yes</td><td>Use of the occupancy value as the only criterion for initiating the CMS collector.</td></tr><tr><td>jvm_G1HeapRegionSize</td><td>integer</td><td>megabytes</td><td><code>8</code></td><td><code>1</code>→<code>32</code></td><td>yes</td><td>Sets the size of the regions for G1.</td></tr><tr><td>jvm_G1ReservePercent</td><td>integer</td><td> </td><td><code>10</code></td><td><code>0</code> → <code>50</code></td><td>yes</td><td>Sets the percentage of the heap that is reserved as a false ceiling to reduce the possibility of promotion failure for the G1 collector.</td></tr><tr><td>jvm_G1NewSizePercent</td><td>integer</td><td> </td><td><code>5</code></td><td><code>0</code> → <code>100</code></td><td>yes</td><td>Sets the percentage of the heap to use as the minimum for the young generation size.</td></tr><tr><td>jvm_G1MaxNewSizePercent</td><td>integer</td><td> </td><td><code>60</code></td><td><code>0</code> → <code>100</code></td><td>yes</td><td>Sets the percentage of the heap size to use as the maximum for young generation size.</td></tr><tr><td>jvm_G1MixedGCLiveThresholdPercent</td><td>integer</td><td> </td><td><code>85</code></td><td><code>0</code> → <code>100</code></td><td>yes</td><td>Sets the occupancy threshold for an old region to be included in a mixed garbage collection cycle.</td></tr><tr><td>jvm_G1HeapWastePercent</td><td>integer</td><td> </td><td><code>5</code></td><td><code>0</code> → <code>100</code></td><td>yes</td><td>The maximum percentage of the reclaimable heap before starting mixed GC.</td></tr><tr><td>jvm_G1MixedGCCountTarget</td><td>integer</td><td>collections</td><td><code>8</code></td><td><code>0</code> → <code>100</code></td><td>yes</td><td>Sets the target number of mixed garbage collections after a marking cycle to collect old regions with at most <code>G1MixedGCLIveThresholdPercent</code> live data. The default is 8 mixed garbage collections.</td></tr><tr><td>jvm_G1OldCSetRegionThresholdPercent</td><td>integer</td><td> </td><td><code>10</code></td><td><code>0</code> → <code>100</code></td><td>yes</td><td>The upper limit on the number of old regions to be collected during mixed GC.</td></tr><tr><td>jvm_G1AdaptiveIHOPNumInitialSamples</td><td>integer</td><td></td><td><code>3</code></td><td><code>1</code>→<code>2097152</code></td><td>yes</td><td>The number of completed time periods from initial mark to first mixed GC required to use the input values for prediction of the optimal occupancy to start marking.</td></tr><tr><td>jvm_G1UseAdaptiveIHOP</td><td>categorical</td><td></td><td><code>+G1UseAdaptiveIHOP</code></td><td><code>+G1UseAdaptiveIHOP</code>, <code>-G1UseAdaptiveIHOP</code></td><td>yes</td><td>Adaptively adjust the initiating heap occupancy from the initial value of <code>InitiatingHeapOccupancyPercent</code>.</td></tr></tbody></table>

### Compilation

<table><thead><tr><th width="247">Name</th><th>Type</th><th>Unit</th><th>Default</th><th>Domain</th><th>Restart</th><th>Description</th></tr></thead><tbody><tr><td>jvm_reservedCodeCacheSize</td><td>integer</td><td>megabytes</td><td><code>240</code></td><td><code>3</code> → <code>2048</code></td><td>yes</td><td>The maximum size of the compiled code cache pool.</td></tr><tr><td>jvm_tieredCompilation</td><td>categorical</td><td> </td><td><code>+TieredCompilation</code></td><td><code>+TieredCompilation</code>, <code>-TieredCompilation</code></td><td>yes</td><td>The type of the garbage collection algorithm.</td></tr><tr><td>jvm_tieredCompilationStopAtLevel</td><td>integer</td><td> </td><td><code>4</code></td><td><code>0</code> → <code>4</code></td><td>yes</td><td>Overrides the number of detected CPUs that the VM will use to calculate the size of thread pools.</td></tr><tr><td>jvm_compilationThreads</td><td>integer</td><td>threads</td><td>You should select your own default value.</td><td>You should select your own domain.</td><td>yes</td><td>The number of compilation threads.</td></tr><tr><td>jvm_backgroundCompilation</td><td>categorical</td><td> </td><td><code>+BackgroundCompilation</code></td><td><code>+BackgroundCompilation</code>, <code>-BackgroundCompilation</code></td><td>yes</td><td>Allow async interpreted execution of a method while it is being compiled.</td></tr><tr><td>jvm_inline</td><td>categorical</td><td> </td><td><code>+Inline</code></td><td><code>+Inline</code>, <code>-Inline</code></td><td>yes</td><td>Enable inlining.</td></tr><tr><td>jvm_maxInlineSize</td><td>integer</td><td>bytes</td><td><code>35</code></td><td><code>1</code> → <code>2097152</code></td><td>yes</td><td>The bytecode size limit (in bytes) of the inlined methods.</td></tr><tr><td>jvm_inlineSmallCode</td><td>integer</td><td>bytes</td><td><code>2000</code></td><td><code>1</code> → <code>16384</code></td><td>yes</td><td>The maximum compiled code size limit (in bytes) of the inlined methods.</td></tr></tbody></table>

### Other parameters

<table><thead><tr><th width="191">Name</th><th width="138">Type</th><th width="80">Unit</th><th>Default</th><th>Domain</th><th>Restart</th><th>Description</th></tr></thead><tbody><tr><td>jvm_aggressiveOpts</td><td>categorical</td><td> </td><td><code>-AggressiveOpts</code></td><td><code>+AggressiveOpts</code>, <code>-AggressiveOpts</code></td><td>yes</td><td>Turn on point performance compiler optimizations.</td></tr><tr><td>jvm_usePerfData</td><td>categorical</td><td> </td><td><code>+UsePerfData</code></td><td><code>+UsePerfData</code>, <code>-UsePerfData</code></td><td>yes</td><td>Enable monitoring of performance data.</td></tr><tr><td>jvm_useNUMA</td><td>categorical</td><td> </td><td><code>-UseNUMA</code></td><td><code>+UseNUMA</code>, <code>-UseNUMA</code></td><td>yes</td><td>Enable NUMA.</td></tr><tr><td>jvm_useBiasedLocking</td><td>categorical</td><td> </td><td><code>+UseBiasedLocking</code></td><td><code>+UseBiasedLocking</code>, <code>-UseBiasedLocking</code></td><td>yes</td><td>Manage the use of biased locking.</td></tr><tr><td>jvm_activeProcessorCount</td><td>integer</td><td>CPUs</td><td><code>1</code></td><td><code>1</code> → <code>512</code></td><td>yes</td><td>Overrides the number of detected CPUs that the VM will use to calculate the size of thread pools.</td></tr></tbody></table>

## Domains

The following parameters require their ranges or default values to be updated according to the described rules:

| **Parameter**             | **Default value**                  | **Domain**                               |
| ------------------------- | ---------------------------------- | ---------------------------------------- |
| jvm\_minHeapSize          |                                    | Depends on the instance available memory |
| jvm\_maxHeapSize          |                                    | Depends on the instance available memory |
| jvm\_newSize              |                                    | Depends on the configured heap           |
| jvm\_maxNewSize           |                                    | Depends on the configured heap           |
| jvm\_concurrentGCThreads  | Depends on the available CPU cores | Depends on the available CPU cores       |
| jvm\_parallelGCThreads    | Depends on the available CPU cores | Depends on the available CPU cores       |
| jvm\_compilation\_threads | Depends on the available CPU cores | Depends on the available CPU cores       |

## Constraints

The following tables show a list of constraints that may be required in the definition of the study, depending on the tuned parameters:

<table><thead><tr><th width="546">Formula</th><th>Notes</th></tr></thead><tbody><tr><td>jvm.jvm_minHeapSize &#x3C;= jvm.jvm_maxHeapSize</td><td> </td></tr><tr><td>jvm.jvm_minHeapFreeRatio &#x3C;= jvm.jvm_maxHeapFreeRatio</td><td> </td></tr><tr><td>jvm.jvm_maxNewSize &#x3C; jvm.jvm_maxHeapSize * 0.8</td><td> </td></tr><tr><td>jvm.jvm_concurrentGCThreads &#x3C;= jvm.jvm_parallelGCThreads</td><td></td></tr><tr><td>jvm_activeProcessorCount &#x3C; container.cpu_limits + 1</td><td></td></tr></tbody></table>
