当前位置:网站首页>JVM (24) -- performance monitoring and tuning (5) -- Analyzing GC logs
JVM (24) -- performance monitoring and tuning (5) -- Analyzing GC logs
2022-07-28 20:07:00 【leo_ messi94】
1. GC Log format
1.1 review :GC classification

Cenozoic collection : When Eden When the area is full, the Cenozoic collection will be carried out , So the Cenozoic collection and S0 Areas and S1 Region independent
The relationship between the old generation collection and the new generation collection : The garbage collection of the younger generation will be carried out before the collection of the older generation , Here's why : A relatively large object cannot be put into the Cenozoic , Then it will naturally go back to the old age , If the old generation can't let go , It will first carry out a new generation of garbage collection , Then try to put... Into the Cenozoic , If you still can't put it down , For the old garbage collection , Then I put it in the old days , This is a process , Let me explain why we need to release them to the elderly , But I can't let go , The reasons for the new generation of garbage collection , This is because the new generation of garbage collection is simpler than the old generation , This saves performance
During garbage collection , The heap contains Cenozoic 、 Old age 、 Meta space / Forever : It can be seen that Heap It includes the Cenozoic 、 Old age 、 Meta space , But when we set the heap size, we only set the new generation 、 It's just the old generation , Meta spaces are set up separately 
1.1.1 What will trigger Full GC:
- There is not enough space in the old age
- Insufficient method space
- Display call System.gc()
- Minior GC The average size of data entering the old age is larger than the available memory of the old age
- Large objects go directly into the old generation , There is not enough space available in the old age
1.2 GC Classification of log
1.2.1 MinorGC


1.2.2 FullGC


1.3 GC Analysis of log structure
1.3.1 Garbage collector

1.3.2 GC Before and after

1.3.3 GC Time

1.4 Minor GC Log parsing
Log data :
2020-11-20T17:19:43.265-0800: add to -XX:+PrintGCDateStamps Parameters . Log printing time Date format Such as 2013-05-04T21:53:59.234+08000.822: add to -XX:+PrintGCTimeStamps This parameter gc occurs ,Java The number of seconds since the virtual machine started[GC(Allocation Failure): There was a garbage collection , This is a time Minior GC. It does not distinguish between the new generation and the old generation GC, The content in brackets is gc What happened , there Allocation Failure The reason is that there is not enough area in the Cenozoic to store the data to be allocated and fail[PSYoungGen:76800K->8433K(89600K):PSYoungGen: Express GC Where it happened , The area name and the used GC Collectors are closely related- Serial The collector :Default New Generation Show Defnew
- ParNew The collector :ParNew
- Parallel Scanvenge The collector :PSYoung
- The new generation is the same as the old generation , It is also related to the collector name
76800K->8433K(89600K):GC The memory area was previously used ->GC Rear cover area capacity ( The total capacity of the area )- If it's the new generation , The total capacity will show the total capacity of the whole Cenozoic memory 9/10, namely eden+from/to District
- If it's an old age , The total capacity is the total memory size , unchanged
76800K->8449K(294400K): Although this time is Minor GC, Only the new generation of garbage collection , But it will also print information about the total capacity in the heap . After displaying the area capacity GC After the situation , The entire heap memory area will then be displayed GC situation :GC Used capacity of front heap memory ->GC Post heap memory capacity ( Total heap memory capacity ), And the total capacity of heap memory = 9/10 The new generation + Old age , Then the total capacity of heap memory must be less than the initialized memory size,0.0088371: Whole GC The time it takes , The unit is seconds[Times:user=0.02 sys=0.01,real=0.01 secs]- user: finger CPU Time spent working in user mode
- sys: finger CPU Time spent working in kernel state
- real: Refers to the total time spent in this event
1.5 Full GC Log parsing
Log data :
2020-11-20T17:19:43.794-0800: add to -XX:+PrintGCDateStamps Parameter log printing . Time Date format Such as 2013-05-04T21:53:59.234+08001.351: add to -XX:+PrintGCTimeStamps This parameter .gc occurs ,Java The number of seconds since the virtual machine startedFull GC(Metadata GCThreshold): There was a garbage collection , This is a time Full GC. It does not distinguish between the Cenozoic GC Or the old generation GC. In parentheses is gc What happened , reason :Metaspace There's not enough space . besides , There are two other situations that can cause Full GC, as follows :Full GC(FErgonomics): reason :JVM Adaptive adjustment leads to GCFull GC(System): reason : Called System.gc() Method
[PSYoungGen: 100082K->0K(89600K)]:PSYoungGen: Express GC Where it happened , The area name and the used GC Collectors are closely related :- Serial The collector :Default New Generation Show DefNew
- ParNew The collector :ParNew
- Parallel Scanvenge The collector :PSYoungGen
- The new generation is the same as the old generation , It is also related to the collector name
10082K->0K(89600K):GC The memory area was previously used ->GC Capacity of this area ( The total capacity of the area )- If it's the new generation , The total capacity will show the total capacity of the whole Cenozoic memory 9/10, namely eden+from/to District
- If it's an old age , The total capacity is the total memory size , unchanged
ParOldGen:32K->9638K(204800K): The old age area did not happen GC, So this time GC yes metaspace Caused by the10114K->9638K(294400K): After displaying the area capacity GC After the situation , The entire heap memory area will then be displayed GC situation :GC Used capacity of front heap memory ->GC Post heap memory capacity ( Total heap memory capacity ), And the total capacity of heap memory = 9/10 The new generation + Old age , Then the total capacity of heap memory must be less than the initialized memory size[Meatspace:20158K->20156K(1067008K)]:metaspace GC Recycling 2K Space,0.0285388: Whole GC The time it takes , The unit is seconds[Times:user=0.11 sys=0.00,real=0.03 secs]- user: finger CPU Time spent working in user mode
- sys: finger CPU Time spent working in kernel state
- real: Refers to the total time spent in this event
2. GC Log analysis tool


A little , Watch videos
边栏推荐
- Codeignier framework implements restful API interface programming
- 【NPP安装插件】
- Common modules of saltstack
- Special draft of Mir | common sense knowledge and reasoning: representation, acquisition and application (deadline on October 31)
- [C language] Gobang game [array and function]
- Kubeedge releases white paper on cloud native edge computing threat model and security protection technology
- In the second half of 2022, the system integration project management engineer certification starts on August 20
- [C language] Hanoi Tower problem [recursion]
- Prometheus deployment
- Leetcode Day1 score ranking
猜你喜欢

CodeIgnier框架实现restful API接口编程
![[C language] step jumping problem [recursion]](/img/0c/32870484e89b494e41068f7c38b08e.png)
[C language] step jumping problem [recursion]

党员故事|李青艾用漫画带动农民增收致富

What is the process of swing event processing?

Thoroughly understand bit operations - shift left, shift right

时间转日期的sql语句应该怎么写?

zfoo增加类似于mydog的路由

2022年下半年系统集成项目管理工程师认证8月20日开班

Leetcode Day1 score ranking
![[NPP installation plug-in]](/img/6f/97e53116ec4ebc6a6338d125ddad8b.png)
[NPP installation plug-in]
随机推荐
Machine learning -- model evaluation, selection and verification
Deploy LNMP automatically with saltstack
Crawl IP
Prometheus deployment
Common APIs in string
Using Lex (Flex) to generate lexical analyzer of PL language
时间转日期的sql语句应该怎么写?
11. Learn MySQL union operator
Sprint for golden nine and silver ten, stay up at night for half a month, collect 1600 real interview questions from Android post of major manufacturers
C language pointer and two-dimensional array
WPF--实现WebSocket服务端
Digital filter design matlab
Use Hal Library of STM32 to drive 1.54 inch TFT screen (240*240 st7789v)
Basic usage of docker
2. Floating point number, the difference between float and double in C language and how to choose them
[C language] simulation implementation of strlen (recursive and non recursive)
河北邯郸:拓展基层就业空间 助力高校毕业生就业
Information management system and games based on C language
Use of strtok and strError
JVM(二十四) -- 性能监控与调优(五) -- 分析GC日志