JRE:
JVM,Java platporm core classes, supporting Java platform libraries.
Performance indicators:
corresponding capabilities, throughput
The main components of jvm
include: class loader, runtime data area, execution engine,
highlighted components are related to jvm performance: Heap: where objects are stored. The Jit compiler also has a large impact on performance, but rarely can be tuned. Reasonable selection of Garbage Collector has a great impact on performance.
Garbage Collector
process:
1. Mark, mark the unreferenced objects. The yellow in the figure indicates the marked objects.
2a, delete, clean up unreferenced objects,
2b, delete with compacting, delete compression. To improve performance, the remaining objects can be compressed together so that subsequent memory allocations are faster and easier.
Why is generational garbage collection needed?
As mentioned before, garbage cleaning and tag cleaning are very inefficient. As more and more objects are allocated, the garbage collection time will become longer and longer, the stw time will be very long, and the performance will become worse and worse. Then through a lot of experience, the survival time of most objects is very short. Therefore, generational garbage treatment is required.
jvm中堆的拆分
the heap is broken up into smaller parts or generations. The heap parts are: Young Generation, Old Generation, and Permanent Generation.
Young Generation 分为3parts:eden,Survivor “from”,Survivor “to”。
Garbage collection process
1. First, all newly created objects are allocated space in the eden area.
2. When the eden area is filled, a Minor Garbage Collection will be performed.
3. After clearing all unreferenced objects in Eden, move the remaining objects in the Eden area to one of the Survivor areas, such as S0, and give the object an age of 1.
4. When the Eden area is filled again, the next Minor GC is performed. After clearing all unreferenced objects in the Eden area and S0 area, move the remaining objects in these two areas to S1, and add one age to all objects.
5. During the next Minor GC, when the objects in the Survivor area reach a certain age such as: 8, they will be moved to Old Generation.
6. When the Old Generation is filled, a Major GC will be performed to clean and compress the control.
Visual GC plug-in
Open the following file and install the Visual GC plug-in.
Rendering: