Dragonwell

This commit is contained in:
lilingfengdev 2024-09-16 12:19:42 +08:00
parent 59dc07f6d7
commit 3a402abbe4
2 changed files with 16 additions and 8 deletions

View File

@ -11,11 +11,13 @@ slug: /optimize/jvm/dragonwell
## 基础
```shell
-XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+AlwaysActAsServerClassMachine -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:NmethodSweepActivity=1 -XX:ReservedCodeCacheSize=400M -XX:NonNMethodCodeHeapSize=12M -XX:ProfiledCodeHeapSize=194M -XX:NonProfiledCodeHeapSize=194M -XX:-DontCompileHugeMethods -XX:MaxNodeLimit=240000 -XX:NodeLimitFudgeFactor=8000 -XX:+UseVectorCmov -XX:+PerfDisableSharedMem -XX:+UseFastUnorderedTimeStamps -XX:+UseCriticalJavaThreadPriority -XX:ThreadPriorityPolicy=1 -XX:AllocatePrefetchStyle=3
-XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+AlwaysActAsServerClassMachine -XX:+AlwaysPreTouch -XX:+DisableExplicitGC -XX:NmethodSweepActivity=1 -XX:ReservedCodeCacheSize=400M -XX:NonNMethodCodeHeapSize=12M -XX:ProfiledCodeHeapSize=194M -XX:NonProfiledCodeHeapSize=194M -XX:-DontCompileHugeMethods -XX:MaxNodeLimit=240000 -XX:NodeLimitFudgeFactor=8000 -XX:+UseVectorCmov -XX:+PerfDisableSharedMem -XX:+UseFastUnorderedTimeStamps -XX:+UseCriticalJavaThreadPriority -XX:ThreadPriorityPolicy=1 -XX:AllocatePrefetchStyle=3 -XX:+UseVtableBasedCHA -Dcom.alibaba.enableFastSerialization=true
```
这些是基础参数
如果使用的是从 GitHub 下载的预览版可以添加`-XX:+UseBigDecimalOpt -XX:+ReduceNMethodSize`
## ZGC
Dragonwell 11 的 ZGC 不同于 OpenJDK11 的 ZGC,Dragonwell 通过移植 OpenJDK 15+的 ZGC补丁,使得Dragonwell的ZGC可以投入生产环境
@ -27,13 +29,9 @@ Dragonwell 11 的 ZGC 不同于 OpenJDK11 的 ZGC,Dragonwell 通过移植 OpenJD
添加参数
```shell
-XX:+UseG1GC -XX:MaxGCPauseMillis=130 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=28 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=20 -XX:G1MixedGCCountTarget=3 -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=0 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -XX:G1SATBBufferEnqueueingThresholdPercent=30 -XX:G1ConcMarkStepDurationMillis=5 -XX:G1ConcRefinementServiceIntervalMillis=150 -XX:G1ConcRSHotCardLimit=16
-XX:+UseG1GC -XX:MaxGCPauseMillis=130 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=28 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=20 -XX:G1MixedGCCountTarget=3 -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=0 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -XX:G1SATBBufferEnqueueingThresholdPercent=30 -XX:G1ConcMarkStepDurationMillis=5 -XX:G1ConcRefinementServiceIntervalMillis=150 -XX:G1ConcRSHotCardLimit=16 -XX:+G1BarrierSimple
```
## 内联优化
添加参数`-XX:+UseVtableBasedCHA`
## 对象头压缩
可以节约10%左右的Java对象内存占用,并可能提升程序性能。**目前仅支持G1GC和ParallelGC**

View File

@ -23,7 +23,13 @@ x86 Java 8 用户可以添加以下附加参数:
-XX:+UseXMMForArrayCopy
```
G1GC 参数
如果使用的是从 GitHub 下载的预览版可以添加
```shell
-XX:+UseBigDecimalOpt
```
## G1GC 参数
```shell
-XX:+UseG1GC -XX:MaxGCPauseMillis=130 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=28 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=20 -XX:G1MixedGCCountTarget=3 -XX:InitiatingHeapOccupancyPercent=10 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=0 -XX:SurvivorRatio=32 -XX:MaxTenuringThreshold=1 -XX:G1SATBBufferEnqueueingThresholdPercent=30
@ -61,4 +67,8 @@ Wisp在JVM上提供了一种用户态的线程实现。开启Wisp2后,Java线程
## G1ElasticHeap
G1ElasticHeap 是一种 GC 功能,用于将 Java 堆的内存返回给操作系统,以减少 Java 进程的内存占用。要启用此功能,你需要通过以下选项使用 G1 GC`-XX:+G1ElasticHeap -XX:+ElasticHeapPeriodicUncommit`
G1ElasticHeap 是一种 GC 功能,用于将 Java 堆的内存返回给操作系统,以减少 Java 进程的内存占用。要启用此功能,你需要通过以下选项使用 G1 GC
```shell
-XX:+G1ElasticHeap -XX:+ElasticHeapPeriodicUncommit
```