当前位置:网站首页>JVM调优思路
JVM调优思路
2022-06-27 05:57:00 【季风泯灭的季节】
JVM运行情况预估
主要依靠jstat gc -pid 命令统计GC运行情况。如年轻代对象增长速率、Young GC的触发频率和每次耗时、每次Young GC后有多少对象存活和进入老年代、Full GC的触发频率和每次耗时 等。在此信息基础上对jvm参数做出调整。
优化的理论依据
- 对象能在年轻代就被淘汰掉的尽量不让他进入老年代
- 尽量不要触发full GC
触发young GC的条件:
- eden区空间不足
触发full GC的条件:
- 老年代空间不足
- 永久代空间不足
- young GC时 触发了老年代空间分配担保机制。
对象进入老年代的条件(即影响老年代对象增长速率):
- 大对象直接进入老年代
- 大年龄对象进入老年代
- young GC时根据动态年龄判断机制,一次放入Survivor的对象大于Survivor区的50%,则多余的对象会放入老年代
full gc比minor gc还多的原因
- 元空间不够导致的多余full gc
- 显示调用System.gc()造成多余的full gc,这种一般线上尽量通过XX:+DisableExplicitGC参数禁用,如果加上了这个JVM启动参数,那么代码中调用System.gc()没有任何效果
- 老年代空间分配担保机制
分析思路
- 首先,根据老年代的对象增长速率,得出理论上发生full GC的频率。用理论频率与实际频率去对比。
- 如果实际频率远比理论频率高,那么根据full gc比minor gc还多的原因分析可能是哪一种原因。如尝试增大元空间大小、禁用System.gc()及避免触发老年代空间分配担保机制。
- 如果实例频率与理论频率相差不多,则说明问题出在老年代对象增长速率上。此时有两种分析思路:
3.1 考虑降低对象进入老年代的速率。用线程分析确定是否有大量的大对象产生,是否在年轻代young GC时触发了动态年龄判断机制使对象进入了老年代。
3.2 考虑增大堆大小,以此降低full GC频率。
边栏推荐
- Spark 之 built-in functions
- 力扣 179、最大数
- 【Cocos Creator 3.5.1】this.node.getPosition(this._curPos)的使用
- Small program of C language practice (consolidate and deepen the understanding of knowledge points)
- 【Cocos Creator 3.5.1】input. Use of on
- 双位置继电器RXMD2-1MRK001984 DC220V
- 函数式 连续式
- Spark 之 Projection
- 使用域名转发mqtt协议,避坑指南
- Add widget on qlistwidgetitem
猜你喜欢

Implementation of easyexcel's function of merging cells with the same content and dynamic title

使用 WordPress快速个人建站指南

How to check the frequency of memory and the number of memory slots in CPU-Z?

Create a basic WDM driver and use MFC to call the driver

Formation and release of function stack frame

免费的 SSH 和 Telnet 客户端PuTTY

爬虫学习5---反反爬之识别图片验证码(ddddocr和pytesseract实测效果)

JS to implement bidirectional data binding

IAR systems fully supports Centrino technology 9 series chips

双位置继电器DLS-34A DC0.5A 220VDC
随机推荐
程序猿学习抖音短视频制作
[FPGA] UART serial port_ V1.1
Asp. Net core6 websocket simple case
Built in functions of spark
【QT小记】QT元对象系统简单认识
Leetcode298 weekly race record
How win 10 opens the environment variables window
Spark's projection
软件测试年终总结报告模板
资深【软件测试工程师】学习线路和必备知识点
js实现双向数据绑定
Open the door small example to learn ten use case diagrams
Using domain name forwarding mqtt protocol, pit avoidance Guide
OpenCV的轮廓检测和阈值处理综合运用
How JQ gets the reciprocal elements
我对于测试团队建设的意见
leetcode298周赛记录
30个单片机常见问题及解决办法!
QListWidgetItem上附加widget
Spark 之 built-in functions