当前位置:网站首页>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 .
边栏推荐
- Big coffee gathering | nextarch foundation cloud development meetup is coming
- Sword finger offer high quality code
- Mysql---- import and export & View & Index & execution plan
- The currently released SKU (sales specification) information contains words that are suspected to have nothing to do with baby
- Matlab tips (29) polynomial fitting plotfit
- 组件的通信
- Use of completable future
- Test of transform parameters of impdp
- How can clothing stores make profits?
- Explain Bleu in machine translation task in detail
猜你喜欢

Special behavior of main function in import statement

关于二进制无法精确表示小数

Composition API 前提

The currently released SKU (sales specification) information contains words that are suspected to have nothing to do with baby

SQLMAP使用教程(四)实战技巧三之绕过防火墙

大咖云集|NextArch基金会云开发Meetup来啦

The latest trends of data asset management and data security at home and abroad

Brand · consultation standardization

Graduation design game mall

Basic process of network transmission using tcp/ip four layer model
随机推荐
异步组件和Suspense(真实开发中)
計算機服務中缺失MySQL服務
From zero to one, I will teach you to build the "clip search by text" search service (2): 5 minutes to realize the prototype
Four goals for the construction of intelligent safety risk management and control platform for hazardous chemical enterprises in Chemical Industry Park
The startup of MySQL installed in RPM mode of Linux system failed
虚拟机的作用
Multidisciplinary integration
RuntimeError: CUDA error: CUBLAS_ STATUS_ ALLOC_ Failed when calling `cublascreate (handle) `problem solving
Network foundation - header, encapsulation and unpacking
Exception of DB2 getting table information: caused by: com ibm. db2.jcc. am. SqlException: [jcc][t4][1065][12306][4.25.13]
How can clothing stores make profits?
Communication of components
ViewModelProvider. Of obsolete solution
Basic process of network transmission using tcp/ip four layer model
Special behavior of main function in import statement
Matlab tips (29) polynomial fitting plotfit
Libcurl returns curlcode description
js小练习----分时提醒问候、表单密码显示隐藏效果、文本框焦点事件、关闭广告
Advantages of using net core / why
How to model and simulate the target robot [mathematical / control significance]