当前位置:网站首页>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频率。
边栏推荐
- Software testing year end summary report template
- Two position relay rxmvb2 r251 204 110dc
- Create a basic WDM driver and use MFC to call the driver
- 【FPGA】UART串口_V1.1
- 【Cocos Creator 3.5.1】this.node.getPosition(this._curPos)的使用
- [FPGA] realize the data output of checkerboard horizontal and vertical gray scale diagram based on bt1120 timing design
- 【养成系】常用正则表达式
- Mechanical transcoding journal [17] template, STL introduction
- 表单校验 v-model 绑定的变量,校验失效的解决方案
- Neon optimization 1: how to optimize software performance and reduce power consumption?
猜你喜欢

Kubesphere cluster configuration NFS storage solution - favorite

免费的 SSH 和 Telnet 客户端PuTTY

openresty使用文档

How win 10 opens the environment variables window

多线程基础部分Part3

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

yaml文件加密

信息系统项目管理师---第七章 项目成本管理
![[FPGA] design and implementation of frequency division and doubling based on FPGA](/img/84/75d473d3d8e670260ba16d06705c2f.png)
[FPGA] design and implementation of frequency division and doubling based on FPGA

Codeforces Round #802 (Div. 2)
随机推荐
C Primer Plus 第11章_字符串和字符串函数_代码和练习题
洛谷P2939 [USACO09FEB]Revamping Trails G 题解
【Cocos Creator 3.5.1】this.node.getPosition(this._curPos)的使用
C语言实现定时器
openstack实例重启状态就会变成错误处理方法,容器搭建的openstack重启计算节点compute服务方法,开机提示Give root password for maintenance处理方法
程序猿学习抖音短视频制作
The form verifies the variables bound to the V-model, and the solution to invalid verification
[cocos creator 3.5.1] addition of coordinates
《汇编语言-王爽》第3章笔记及实验
QListWidget中的内容不显示
leetcode298周赛记录
【Cocos Creator 3.5.1】event.getButton()的使用
【FPGA】基于bt1120时序设计实现棋盘格横纵向灰阶图数据输出
【Cocos Creator 3.5.1】event. Use of getbutton()
【FPGA】 基于FPGA分频,倍频设计实现
【QT小作】使用结构体数据生成读写配置文件代码
Database - index
Asp.Net Core6 WebSocket 简单案例
Jump details of item -h5 list, and realize the function of not refreshing when backing up, and refreshing when modifying data (record scroll bar)
QT using Valgrind to analyze memory leaks