Search code examples
javagarbage-collectiong1gc

What's the difference between 'Survival Count' and 'Tenuring Threshold'? G1 GC


I am looking at a garbage collection report and at the bottom there is the Tenuring Summary section which contains a metric Survival Count - what is this? This is not a metric that I can explicitly see in the GC logs when adding -XX:+PrintTenuringDistribution, is GCeasy intuiting this somehow?


    Age      Survival Count   Average size (kb)   Average Total 'To' size (kb)
    age 1    110              96693.33            96693.33
    age 2    110              2187.87             98881.2

Follow up question - would you consider a high survival count good? Bad? Is it natural for the number to go up? There is a lot of documentation around tenuring threshold which I understand, along with how the G1 gc works, but I cannot find anything regarding this metric.

Thanks for any input!


Solution

  • Posting answer from Ram Lakshmanan here

    Survival Count - what is this? This is not a metric that I can explicitly see in the GC logs when adding -XX:+PrintTenuringDistribution, is GCeasy intuiting this somehow?

    You are right, this field is not printed in the raw GC log file. GCeasy adds this column.

    Below is how tenuring distribution information is printed in the raw GC log:

    Desired survivor size 25165824 bytes, new threshold 15 (max 15)

    • age 1: 975840 bytes, 975840 total
    • age 2: 3250392 bytes, 4226232 total

    Desired survivor size 125829120 bytes, new threshold 15 (max 15)

    • age 1: 1955504 bytes, 1955504 total
    • age 2: 861448 bytes, 2816952 total
    • age 3: 3221904 bytes, 6038856 total

    Desired survivor size 109051904 bytes, new threshold 15 (max 15)

    • age 1: 12321336 bytes, 12321336 total
    • age 2: 1567088 bytes, 13888424 total
    • age 3: 717304 bytes, 14605728 total
    • age 4: 3153216 bytes, 17758944 total

    GCeasy counts number of times 'age 1', 'age 2', 'age 3'.... is present in the GC logs and prints it's sum in the 'survival count' column. It takes average of the second column in the raw GC log and prints it under the 'Average size (kb)' column. It takes average of the third column in the raw GC log and prints it under the 'Average Total 'To' size (kb)' column.

    Follow up question - would you consider a high survival count good? Bad? Is it natural for the number to go up?

    Based on our calculation, it's natural of for earlier ages (i.e. age 1, age 2) to be higher. I don't have much grip on this subject, you may refer to '-XX:+PrintTenuringDistribution' section of this blog.