52 lines
1.9 KiB
Markdown
52 lines
1.9 KiB
Markdown
|
# G1CG调优
|
|||
|
- https://cloud.tencent.com/developer/article/1518229
|
|||
|
- -XX:+UseG1GC -XX:+UseStringDeduplication
|
|||
|
- -Xms2g -Xmx2g
|
|||
|
-XX:+UseG1GC -XX:MaxGCPauseMillis=20 -XX:G1HeapRegionSize=1m -XX:G1MixedGCCountTarget=10
|
|||
|
-Xloggc:/data/server/${app}/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCApplicationStoppedTime
|
|||
|
- -Xms2g -Xmx2g
|
|||
|
-XX:+UseG1GC
|
|||
|
-XX:MaxGCPauseMillis=100 // 调大停顿时间
|
|||
|
-XX:G1HeapRegionSize=2M # 调大region的大小来减少大对象占用的region数
|
|||
|
-XX:MaxTenuringThreshold=5
|
|||
|
-XX:InitiatingHeapOccupancyPercent=40 #手动设置IHOP。
|
|||
|
-XX:ConcGCThreads=4 //当前核心数的一半
|
|||
|
-XX:+UseStringDeduplication
|
|||
|
-XX:AutoBoxCacheMax=20000
|
|||
|
-XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=256m
|
|||
|
-XX:+PrintPromotionFailure
|
|||
|
-XX:+HeapDumpOnOutOfMemoryError
|
|||
|
-XX:HeapDumpPath=./
|
|||
|
-Xlog:gc*:./gc-myapp.log
|
|||
|
-XX:+DisableExplicitGC //禁止显示手动GC,如果系统使用了堆外内存就不要禁用
|
|||
|
-XX:G1MixedGCCountTarget=10 // 把old区的回收分布到更多次GC当中
|
|||
|
- https://zhuanlan.zhihu.com/p/444564414
|
|||
|
|
|||
|
## 启动参数
|
|||
|
```shell
|
|||
|
java -server
|
|||
|
-XX:+UseContainerSupport
|
|||
|
-XX:InitialRAMPercentage=70.0
|
|||
|
-XX:MaxRAMPercentage=70.0
|
|||
|
-XX:+UseG1GC
|
|||
|
-XX:MaxGCPauseMillis=20
|
|||
|
-XX:G1HeapRegionSize=1M
|
|||
|
-XX:InitiatingHeapOccupancyPercent=45
|
|||
|
-XX:+UseStringDeduplication
|
|||
|
-Ddruid.mysql.usePingMethod=false
|
|||
|
-javaagent:/app/skywalking-agent/skywalking-agent.jar
|
|||
|
-Dskywalking.agent.service_name=qifu-saas-wms-prod
|
|||
|
-Dskywalking.collector.backend_service=oap.qifu.svc:11800
|
|||
|
-jar
|
|||
|
-javaagent:/app/jmx_prometheus_javaagent-0.20.0.jar=8088:/app/jmx_exporter.yaml
|
|||
|
/app/qifu-saas-wms-service-1.0.13.jar
|
|||
|
--spring.config.location=/app/config/bootstrap.yml
|
|||
|
```
|
|||
|
### 参数说明
|
|||
|
- https://www.cnblogs.com/yu007/p/17900844.html
|
|||
|
- 容器环境替代 `-Xmx -Xms`:
|
|||
|
- ```shell
|
|||
|
-XX:+UseContainerSupport
|
|||
|
-XX:InitialRAMPercentage=70.0
|
|||
|
-XX:MaxRAMPercentage=70.0
|
|||
|
```
|