Java GC Log Parsing

Source: Internet
Author: User
Tags cpu usage glassfish

JVM in the Java application optimization is an indispensable major, how to properly configure the Java parameters, if the validity of the validation configuration parameters, from the GC log can be very important hints, the following is the GC garbage collector by default on the combination of the analysis of the log, I hope to help students want to learn O (∩_∩) o~~

Tools/Materials
    • jdk1.6
    • -xx:+printgcdetails
    • Xx:+printgctimestamps
    • -xloggc:filename
    • GlassFish
Method/Step
  1. 1

    The default default-enabled combination of the Hotspot JVM GC garbage collector is:

  2. 2

    Use the GC log command-line options to:

    -xx:+printgctimestamps

    -xx:+printgcdetails

    -xloggc:<filename>

  3. 3

    JVM "-server"

    GlassFish Application Server-server start the garbage collector by default combination of

    New generation: Parallel Scavenge parallel recovery GC

    Older generation and durable generation: Parallel old parallel GC

  4. 4

    GC Log printing information :

    -xx:+printgctimestamps output Format:

    289.556: [GC [psyounggen:314113k->15937k (300928K)] 405513k->107901k (407680K), 0.0178568 secs] [times:user=0.06 sys=0.00, real=0.01 secs]

    293.271: [GC [Psyounggen:300865k->6577k (310720K)] 392829k->108873k (417472K), 0.0176464 secs] [times:user=0.06 sys=0.00, real=0.01 secs]

    Detailed

    293.271 is the time from the start of the JVM until the garbage collection takes place, and the GC indicates that this is a minor GC (generation garbage collection); [psyounggen:300865k->6577k (310720K)] Provides information about the new generation of space, Psyounggen, which indicates that the new generation uses a multithreaded garbage collector parallel scavenge. 300865K indicates that the new generation occupies space before garbage collection, and 6577K represents the new generation of space after garbage collection. The Cenozoic is subdivided into one Eden area and two survivor areas, Minor GC after the Eden area is empty, 6577K is the space occupied by survivor.

    The 310720K in parentheses represents the size of the entire young generation.

    392829k->108873k (417472K), which indicates the size of the Java heap before (392829K) and after garbage collection (108873K) (Total heap 417472K, heap size includes cenozoic and older generations)

    The new generation and Java heap occupancy can calculate the old generation occupied space, such as, Java heap size 417472K, Cenozoic size 310720K so the old generation occupied space is 417472k-310720k=106752k Garbage collection before the old age occupied space for 392829k-300865k=91964k garbage collection after the old age occupied space 108873k-6577k=102296k.

    0.0176464 secs represents the time spent in the garbage collection process.

    [times:user=0.06 sys=0.00, real=0.01 secs] provides CPU usage and time consumption, user mode garbage collection consumes CPU time, The garbage collector consumes 0.06 seconds of user-state CPU time in the instance, SYS is the CPU time consumed by the system, and real refers to the actual time consumed by the garbage collector.

  5. 5

    -xx:+printgcdetails output Format:

    293.289: [Full GC [psyounggen:6577k->0k (310720K)]

    [Psoldgen:102295k->102198k (134208K)] 108873k->102198k (444928K)

    [pspermgen:59082k->58479k (104192K)], 0.3332354 secs]

    [times:user=0.33 sys=0.00, real=0.33 secs]

    Description

    Full GC indicates the global garbage collection is performed

    [psyounggen:6577k->0k (310720K)] Provides a new generation of spatial information, explaining ibid.

    [Psoldgen:102295k->102198k (134208K)] provides the information of the old generation space;

    108873k->102198k (444928K) entire heap space information;

    [pspermgen:59082k->58479k (104192K)] provides a permanent space information;

  6. 6

    JVM "-client"

    GlassFish Application Server default-client start garbage collector The default combination is

    Cenozoic: Serial serial GC (Cenozoic uses-XX:+USESERIALGC collector)

    Older generation and durable generation: Serial old serial GC

  7. 7

    GC log printing information:

     

    -xx:+printgctimestamps output format:

    9.007: [gc 9.007: [defnew: 13526k->1060k (14400K), 0.0041350 secs]  44692k->32226k (46108K),  0.0041767 secs] [times: user=0.01 sys=0.00, real=0.01  secs] 

    9.259: [gc 9.259: [defnew: 13924k->1089k (14400K),  0.0042760 secs] 45090k->32650k (46108K),  0.0043143 secs] [times: user=0.02 &NBSP;SYS=0.00,&NBSP;REAL=0.02&NBSP;SECS]&NBSP

    Description:

    Defnew indicates that the Cenozoic uses the serial serial GC garbage collector, Defnew provides the Cenozoic space information;

    defnewgeneration  is  default new generation

  8. 8

    -xx:+printgcdetails output Format:

    9.348: [GC 9.348: [defnew:13953k->976k (14400K), 0.0040943 secs]9.352: [tenured:32163k->32220k (32220K), 0.1182207 secs] 45514k->32338k (46620K), [perm:30467k->30467k (65536K)], 0.1224318 secs] [times:user=0.12 sys= 0.00, real=0.13 secs]

    Defnew: Indicates the Cenozoic uses serial serial GC garbage collector, Defnew provides the Cenozoic space information;

    Tenured: Provide space information for older generations;

    45514k->32338k (46620K): The whole heap space size information;

    Perm: Provide persistent generation space information;

Java GC Log Parsing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.