Detailed explanation of ParallelGC logs
JVM startup parameters
1 |
|
Setting JVM startup parameters
- -XX:+PrintGCDetails: Output detailed information of GC, including heap memory usage after each garbage collection and the status before and after collection.
- -Xloggc:/home/gc.log: Save GC logs to the file /home/gc.log instead of outputting to the console. This allows the logs to be analyzed after the application has run.
- -XX:+PrintGCDateStamps: Add a date stamp to each GC log record to facilitate viewing the time when garbage collection occurred.
- -XX:+PrintGCTimeStamps: Add the elapsed time after JVM startup to each GC log, in seconds.
- -XX:+PrintHeapAtGC: Print the detailed status of the heap before and after garbage collection, including the memory allocation of each generation (young generation, old generation, metaspace).
- -XX:+UseParallelGC: Use Parallel GC (parallel garbage collector) to improve performance by executing garbage collection in parallel with multiple threads.
GC log snippet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
Application pause time
During the GC process, all threads of the application are suspended, which is called the "Stop-The-World" (STW) event. Pause time directly affects the performance and responsiveness of the application.
Log example:
1 |
|
Total time for which application threads were stopped:
- The total time the application thread was suspended, here is 0.0015655 seconds (~1.57 milliseconds).
Stopping threads took:
- The time spent suspending the thread, here 0.0000978 seconds (approximately 0.098 milliseconds).
GC (Minor GC)
Log example
1 |
|
- GC type: Minor GC, triggered by memory allocation failure (Allocation Failure).
- Young generation changes: from 1466389K to 41915K, total capacity 1492992K.
- Total change in heap memory: from 1538798K to 152295K, total capacity 4114432K.
- Time taken: 0.0591035 seconds (about 59 milliseconds).
Full GC
Log example:
1 |
|
- GC type: Full GC, triggered by JVM adaptive mechanism (Ergonomics).
- Young generation change: from 26414K to 0K, indicating that the young generation has been fully recycled.
- Old generation changes: reduced from 2082863K to 300700K, freeing up a lot of memory.
- Total change in heap memory: from 2109278K to 300700K, total capacity 4158464K.
- Metaspace change: reduced from 176015K to 174750K.
- Time taken: 0.6404574 seconds (about 640 milliseconds).
Detailed status of heap memory
Due to the use of the -XX:+PrintHeapAtGC parameter, the GC log will print the detailed status of the heap memory before and after each GC, including the capacity and usage of each memory area.
Log example:
1 2 3 4 5 6 7 8 9 |
|
-
PSYoungGen (young generation):
- total (total capacity): 1494528K.
- used: 1466389K.
- eden space (Eden area): capacity 1414656K, usage rate 100%.
- from space (Survivor area): Capacity 79872K, usage rate 64%.
- to space (Survivor area): capacity 78336K, unused.
-
ParOldGen (old generation):
- total (total capacity): 2621440K.
- used: 72408K, usage rate is about 2%.
-
Metaspace:
- used: 114761K.
- capacity: 120350K.
Correspondence between JVM startup parameters and GC logs
Due to manually setting the JVM startup parameters, the GC logs contain more detailed information that facilitates in-depth analysis:
-
Memory allocation and usage:
- With -XX:+PrintHeapAtGC, you can view the heap memory status before and after each GC and understand the memory allocation and usage of each area.
-
Time stamp information:
- -XX:+PrintGCDateStamps and -XX:+PrintGCTimeStamps provide precise time information to facilitate analysis of the time points and intervals of GC events.
-
GC event details:
- -XX:+PrintGCDetails outputs detailed information such as the type of GC event, triggering reason, memory recycling status and time consumption.
The above is the detailed content of Detailed explanation of ParallelGC logs. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











Troubleshooting and solutions to the company's security software that causes some applications to not function properly. Many companies will deploy security software in order to ensure internal network security. ...

Solutions to convert names to numbers to implement sorting In many application scenarios, users may need to sort in groups, especially in one...

Field mapping processing in system docking often encounters a difficult problem when performing system docking: how to effectively map the interface fields of system A...

When using MyBatis-Plus or other ORM frameworks for database operations, it is often necessary to construct query conditions based on the attribute name of the entity class. If you manually every time...

Start Spring using IntelliJIDEAUltimate version...

Conversion of Java Objects and Arrays: In-depth discussion of the risks and correct methods of cast type conversion Many Java beginners will encounter the conversion of an object into an array...

Detailed explanation of the design of SKU and SPU tables on e-commerce platforms This article will discuss the database design issues of SKU and SPU in e-commerce platforms, especially how to deal with user-defined sales...

How does the Redis caching solution realize the requirements of product ranking list? During the development process, we often need to deal with the requirements of rankings, such as displaying a...
