当前位置:网站首页>Brief ideas and simple cases of JVM tuning - how to tune

Brief ideas and simple cases of JVM tuning - how to tune

2022-06-24 03:47:00 InfoQ

Look at the last part , Based on this condition in the previous article , How do we tune ?

Survivor The area is obviously inadequate .  The life cycle of most objects in this scene is extremely short , It should not be allowed to enter the old generation frequently , At the same time, there is no need to maintain too much space for the old age , Try to keep objects in the new generation to be recycled . Because this is the background of an order , It won't have too many long - lived objects , So the goal is to keep objects in the new generation as much as possible and they will be recycled .

So consider adjusting the Cenozoic generation to 2G, The old age was adjusted to 1G, So at this time Eden The size of the area is 1.6G, Every Survivor The size of the area is 200MB. This is the time Eden Area and two Survivor Area proportion or  8  Than  1  Than 1

null

So at this point  Survivor  After the area gets bigger , The example we just gave , this  100 MB The garbage object of , Can smoothly enter this other  Survivor  District . During the next garbage collection , It can also be recycled smoothly , Surviving data and memory usage are greatly reduced .

here Survivor The area is bigger , This will greatly reduce the cost of the new generation GC After the survival of the object in Survivor A problem that cannot be accommodated , It also avoids triggering the dynamic age determination mechanism , The problem of going directly into the old age .

Come here ,JVM The main contents of the brief tuning of are almost covered , This is just a simple case and a brief idea . Tuning in daily work , It is also basically inseparable from this similar idea : We try to make FULL GC  Less likely , Old age  GC  Also try to put it into the new generation when it is not necessary  GC  Do it inside .

Simply take out some very shallow things to share with you , Let everyone have an impression , If you have mastered this well , You can share more , If there is a chance to follow up , I will also do more in-depth research on this column .
原网站

版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206240032531231.html