当前位置:网站首页>JVM garbage collector part 1
JVM garbage collector part 1
2022-07-06 17:14:00 【Smart popcorn】
1. Garbage collector classification
Press Working mode
classification , Garbage collectors can be divided into :
- Concurrent garbage collection
- Exclusive garbage collection
Hairstyle It means that multiple threads perform garbage collection alternately , The pause time of the program is reduced .
exclusive It means that once garbage collection is performed , Stop other user threads , That is, once garbage collection is performed , The user program will not work .
Press Number of threads
classification , Garbage collectors can be divided into :
- Serial garbage collector
- Parallel garbage collector
- Concurrent garbage collector
Serial GC Only suitable for single core CPU Upper use , It works better , It's not used now .
parallel GC It refers to multiple threads performing garbage collection at the same time , But it is still exclusive , There will be stop the world The phenomenon of .
Concurrent GC It refers to the alternate execution of garbage collection threads and user threads , There is no need to pause .
Press Pieces processing
classification , Garbage collectors can be divided into :
- Compression garbage collector
- Uncompressed garbage collector
This is mainly aimed at the mark removal algorithm , Some recyclers do not use this algorithm , That's why there is this classification .
Press The working memory
classification , Garbage collectors can be divided into the garbage collection of the new generation and the old generation , Because these two areas are very different , Different garbage collectors are generated according to these two areas .
2. assessment GC Performance index of
There are many kinds of indicators , Briefly introduce .
throughput : It refers to the proportion of user thread execution time in the total time , Of course, the bigger the better .
Garbage collection expenses : Refers to the proportion of garbage collection threads in the total time , The smaller the better. .
Pause time : This is what we often say STW, No matter which garbage collector has a pause time , This is caused by the garbage collection thread , We hope the shorter the better .
Collection frequency : It refers to the proportion of garbage collection times in a certain period of time , It depends on the situation , When the frequency is high , Unit pause time is short , The frequency is low , Unit pause time is long .
Memory footprint : Generally refers to the occupation of the heap area , The larger it is, the more objects it can store .
Fast : A bit abstract , We hope that objects can be recycled as soon as they are not used .
Notice the bold noun in front of me ?
These make up the Impossible Triangle , Too much memory , The longer it takes to garbage collect objects once , It also makes the pause time longer , But throughput can be improved , Anyway, the memory is small , Throughput gets lower , But the pause time will become smaller .
But there is still a specific standard , Because memory is relatively cheap , We hope that under the premise of maximum throughput , Can reduce pause time .
3. The history of garbage collector
Just to understand , Here is a cut-off picture , You can simply look at the content in the red box .
4. Seven classic garbage collectors
Serial GC:Serial,Serial Old, The difference between the two is that the former is recycled by the Cenozoic , The latter recycles the elderly .
parallel GC:ParNew,Parallel Scavenge,Parallel Old.
Concurrent GC:CMS,G1, among G1 Count the all-around players .
5. The combination of garbage collectors
Need to know , Not one JVM Just use a garbage collector , They are used together , The combination is as follows , The dotted line indicates that it will be eliminated in later versions .
6. See the default garbage collector
Before any program starts , We can join in JVM Parameters , Print out what the default garbage collector is .
-XX:+PrintCommandLineFlags
The results are as follows ,jdk The default is ParallelGC
-XX:InitialHeapSize=265723392 -XX:MaxHeapSize=4251574272 -XX:+PrintCommandLineFlags -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC
We will focus on different garbage collectors in the next article .
边栏推荐
- QT system learning series: 1.2 style sheet sub control lookup
- ByteDance open source Gan model compression framework, saving up to 97.8% of computing power - iccv 2021
- Full record of ByteDance technology newcomer training: a guide to the new growth of school recruitment
- 谢邀,人在工区,刚交代码,在下字节跳动实习生
- 唯有学C不负众望 TOP5 S1E8|S1E9:字符和字符串&&算术运算符
- 亮相Google I/O,字节跳动是这样应用Flutter的
- Flink parsing (VI): savepoints
- Restful style interface design
- 唯有学C不负众望 TOP3 Demo练习
- Instructions for Redux
猜你喜欢
Activit零零碎碎要人命的坑
"One year after graduation, I won ACL best paper"
Activiti directory (III) deployment process and initiation process
Notes on how the network is connected
Mongodb learning notes
Flink 解析(四):恢复机制
1. JVM入门介绍
Which is more important for programming, practice or theory [there are some things recently, I don't have time to write an article, so I'll post an article on hydrology, and I'll fill in later]
吴军三部曲见识(七) 商业的本质
Thank you for your invitation. I'm in the work area. I just handed in the code. I'm an intern in the next ByteDance
随机推荐
TCP的三次握手和四次挥手
Flink 解析(七):时间窗口
8086 CPU internal structure
8086 segmentation technology
MySQL optimization notes
8086 memory
Many papers on ByteDance have been selected into CVPR 2021, and the selected dry goods are here
ByteDance technical Interviewer: what kind of candidate do I want to pick most
Activiti目录(四)查询代办/已办、审核
Some instructions on whether to call destructor when QT window closes and application stops
JVM之垃圾回收器上篇
Thank you for your invitation. I'm in the work area. I just handed in the code. I'm an intern in the next ByteDance
SQL tuning notes
亮相Google I/O,字节跳动是这样应用Flutter的
Ruoyi-Cloud 踩坑的BUG
Which is more important for programming, practice or theory [there are some things recently, I don't have time to write an article, so I'll post an article on hydrology, and I'll fill in later]
Introduction to spring trick of ByteDance: senior students, senior students, senior students, and the author "brocade bag"
ByteDance open source Gan model compression framework, saving up to 97.8% of computing power - iccv 2021
The daemon thread starts redis and modifies the configuration file
Programmer orientation problem solving methodology