当前位置:网站首页>Fullgc problem analysis and solution summary
Fullgc problem analysis and solution summary
2022-07-07 07:16:00 【How to solve the problem, only】
One 、 common FullGC Scene analysis
1.1、 Frequent large objects , Large objects are directly assigned to the old age .
1.2、 The system runs at high load , A lot of requests ,jvm There is no time to move the object to the old age , Go directly to the old age to allocate objects .
1.3、 System memory leak , Lead to the object in the elderly generation for a long time , No release .
Two 、 produce FullGC Why
2.1、System.gc() Method call
Called in code System.gc() Method meeting recommendations JVM Conduct Full GC, But note that this is just a suggestion ,JVM Whether to execute or not is another matter , But in most cases, it will increase Full GC The number of times , Results in system performance degradation , It is generally recommended not to call this method manually , Can pass -XX:+ DisableExplicitGC To prohibit RMI call System.gc.
2.2、 There was not enough space in the old days
stay Survivor When the object of the region meets the conditions for promotion to the old age , The size of the object promoted into the old age is larger than the available memory of the old age , This time will trigger Full GC.
2.3、Metaspace The memory area has reached the threshold
from JDK8 Start , Forever (PermGen) The concept of "is abandoned" , Instead, it's called Metaspace Storage space .Metaspace Using local memory , Instead of heap memory , That is to say, by default Metaspace The size of is only related to the size of the local memory .-XX:MetaspaceSize=21810376B( about 20.8MB) Exceeding this value will cause Full GC, This value is not fixed , It will follow JVM Dynamically adjust the operation of .
jdk8 Metaspace tuning
Survivor There are two situations when regional objects are promoted to the old age :
1、 One is to define an object counter for each object , If the object is Eden Regional birth , And after the first time GC, Then set his age to 1, stay Survivor Every time the object in the area survives GC, Add one to the age counter , Wait until the default value is reached 15 when , It will be moved to the older generation , The default value can be through -XX:MaxTenuringThreshold To set up .
2、 Another situation is if JVM Find out Survivor When objects of the same age in the region account for more than half of all objects , Objects older than this age will be moved to the old age , After statistics, it is found that these objects can be promoted to the old age , But I found that there was not enough space for these objects in the old age , This will cause Full GC.
This parameter can be passed through -XX:PretenureSizeThreshold To set , Large objects or long-lived objects enter the elderly generation , A typical large object is a long string or array , After they are created, they will directly enter the older generation , Although it may be in the Cenozoic Eden The area can place this object , When you want to place JVM If you find that there is not enough space in the old age , Will trigger GC.
2.4、 Lack of continuous space for the elderly
JVM If it is judged that there is not enough continuous space to place large objects in the old age , Then it will cause Full GC, For example, the available space in the old age is 200K, But it's not continuous , Continuous memory as long as 100K, The size of the object promoted to the old age is 120K, because 120>100 Continuous space of , So it triggers Full GC.
3、 ... and 、 Common analysis methods
First step : Use jstat –gcutil Command attention full gc frequency 、full gc Implementation time and changes in the proportion of the elderly ; It is found that the proportion of the old age increases rapidly, which indicates that there are more large objects or that the young generation is configured with too small objects and enters the old generation quickly ; It is found that the elderly generation takes a long time and performs full gc There is little or no change in the latter proportion , Then it means that the object has always existed and the reference has not been released .
The second step : see gc journal , Focus on full gc When triggered, the situation of objects in the elderly generation before and after recycling and the time consumption of implementing recycling , There is also a clear reason for triggering full gc, If you see System.gc The result indicates that there is a call execution in the code full gc.
The third step : If there is a problem with heap memory, use jmap –histo Command to view the memory usage of the current application heap , Analyze those objects that are generated by application services and occupy high memory , This kind of object focuses on and analyzes .
Step four : Need to analyze the object call link , Execute first jmap -dump:live,format=b,file Will heap memory dump Come down , And then use mat Tool open view .
边栏推荐
- Common function detect_ image/predict
- Pass parent component to child component: props
- Multithreading and high concurrency (9) -- other synchronization components of AQS (semaphore, reentrantreadwritelock, exchanger)
- Graduation design game mall
- Readonly read only
- readonly 只读
- transform-origin属性详解
- $parent (get parent component) and $root (get root component)
- After the promotion, sales volume and flow are both. Is it really easy to relax?
- Can 7-day zero foundation prove HCIA? Huawei certification system learning path sharing
猜你喜欢
From zero to one, I will teach you to build the "clip search by text" search service (2): 5 minutes to realize the prototype
Unity3d learning notes
Role of virtual machine
Leetcode t1165: log analysis
Kuboard无法发送邮件和钉钉告警问题解决
. Net core accesses uncommon static file types (MIME types)
Config distributed configuration center
非父子组件的通信
$refs: get the element object or sub component instance in the component:
Pass child component to parent component
随机推荐
弹性布局(一)
How Oracle backs up indexes
Multidisciplinary integration
请问 flinksql对接cdc时 如何实现计算某个字段update前后的差异 ?
组件的嵌套和拆分
. Net 5 fluentftp connection FTP failure problem: this operation is only allowed using a successfully authenticated context
Master-slave replication principle of MySQL
Procedure in PostgreSQL supports transaction syntax (instance & Analysis)
Leetcode t1165: log analysis
【JDBC以及内部类的讲解】
A slow SQL drags the whole system down
Abnova membrane protein lipoprotein technology and category display
leetcode 509. Fibonacci number
Libcurl returns curlcode description
Config distributed configuration center
MySQL binlog related commands
Jesd204b clock network
关于数据库数据转移的问题,求各位解答下
The latest trends of data asset management and data security at home and abroad
Abnova circulating tumor DNA whole blood isolation, genomic DNA extraction and analysis