Why is G1GC collection usage threshold not updated early?

Sundara Mohan M email.sundarms at gmail.com
Wed Jun 28 18:54:36 UTC 2017


I am trying to estimate the free memory using metrics from
MemoryPoolMxBean.getCollectionUsage().

I am observing following behavior with G1GC

iteration=    0 - G1 Old Gen: u=  0% cu=  0% uth=75% cuth=75%
iteration=  100 - G1 Old Gen: u=  0% cu=  0% uth=75% cuth=75%
iteration=  200 - G1 Old Gen: u=  0% cu=  0% uth=75% cuth=75%
iteration=  300 - G1 Old Gen: u=  0% cu=  0% uth=75% cuth=75%
iteration=  400 - G1 Old Gen: u=  0% cu=  0% uth=75% cuth=75%
iteration=  500 - G1 Old Gen: u=  1% cu=  0% uth=75% cuth=75%
iteration=  600 - G1 Old Gen: u=  4% cu=  0% uth=75% cuth=75%
iteration=  700 - G1 Old Gen: u=  9% cu=  0% uth=75% cuth=75%
iteration=  800 - G1 Old Gen: u= 16% cu=  0% uth=75% cuth=75%
iteration=  900 - G1 Old Gen: u= 25% cu=  0% uth=75% cuth=75%
iteration= 1000 - G1 Old Gen: u= 34% cu=  0% uth=75% cuth=75%
iteration= 1100 - G1 Old Gen: u= 45% cu=  0% uth=75% cuth=75%
iteration= 1200 - G1 Old Gen: u= 38% cu=  0% uth=75% cuth=75%
iteration= 1300 - G1 Old Gen: u= 46% cu=  0% uth=75% cuth=75%
iteration= 1400 - G1 Old Gen: u= 52% cu=  0% uth=75% cuth=75%
iteration= 1500 - G1 Old Gen: u= 45% cu=  0% uth=75% cuth=75%
iteration= 1600 - G1 Old Gen: u= 67% cu=  0% uth=75% cuth=75%
iteration= 1700 - G1 Old Gen: u= 56% cu=  0% uth=75% cuth=75%
iteration= 1800 - G1 Old Gen: u= 55% cu=  0% uth=75% cuth=75%
iteration= 1900 - G1 Old Gen: u= 61% cu=  0% uth=75% cuth=75%
iteration= 2000 - G1 Old Gen: u= 56% cu=  0% uth=75% cuth=75%
iteration= 2100 - G1 Old Gen: u= 76% cu=  0% uth=75% cuth=75%
iteration= 2200 - G1 Old Gen: u= 65% cu=  0% uth=75% cuth=75%
iteration= 2300 - G1 Old Gen: u= 62% cu=  0% uth=75% cuth=75%
iteration= 2400 - G1 Old Gen: u= 75% cu=  0% uth=75% cuth=75%
iteration= 2500 - G1 Old Gen: u= 75% cu=  0% uth=75% cuth=75%
iteration= 2600 - G1 Old Gen: u= 72% cu=  0% uth=75% cuth=75%
iteration= 2700 - G1 Old Gen: u= 69% cu=  0% uth=75% cuth=75%
iteration= 2800 - G1 Old Gen: u= 74% cu=  0% uth=75% cuth=75%
iteration= 2900 - G1 Old Gen: u= 80% cu=  0% uth=75% cuth=75%
iteration= 3000 - G1 Old Gen: u= 83% cu=  0% uth=75% cuth=75%

*iteration= 3100 - G1 Old Gen: u= 89% cu=  0% uth=75% cuth=75%iteration=
3200 - G1 Old Gen: u= 71% cu= 59% uth=75% cuth=75%*
iteration= 3300 - G1 Old Gen: u= 90% cu= 59% uth=75% cuth=75%
iteration= 3400 - G1 Old Gen: u= 76% cu= 62% uth=75% cuth=75%
iteration= 3500 - G1 Old Gen: u= 65% cu= 65% uth=75% cuth=75%


CMS GC

iteration=    0 - CMS Old Gen: u=  0% cu=  0% uth=75% cuth=75%
iteration=  100 - CMS Old Gen: u=  0% cu=  0% uth=75% cuth=75%
iteration=  200 - CMS Old Gen: u=  1% cu=  0% uth=75% cuth=75%
iteration=  300 - CMS Old Gen: u=  3% cu=  0% uth=75% cuth=75%
iteration=  400 - CMS Old Gen: u= 12% cu=  0% uth=75% cuth=75%
iteration=  500 - CMS Old Gen: u= 19% cu=  0% uth=75% cuth=75%
iteration=  600 - CMS Old Gen: u= 34% cu=  0% uth=75% cuth=75%
iteration=  700 - CMS Old Gen: u= 43% cu=  0% uth=75% cuth=75%
*iteration=  800 - CMS Old Gen: u= 63% cu=  0% uth=75% cuth=75%*
*iteration=  900 - CMS Old Gen: u= 48% cu= 37% uth=75% cuth=75%*
*iteration= 1000 - CMS Old Gen: u= 60% cu= 37% uth=75% cuth=75%*
iteration= 1100 - CMS Old Gen: u= 58% cu= 45% uth=75% cuth=75%
iteration= 1200 - CMS Old Gen: u= 71% cu= 45% uth=75% cuth=75%
iteration= 1300 - CMS Old Gen: u= 66% cu= 53% uth=75% cuth=75%
iteration= 1400 - CMS Old Gen: u= 80% cu= 53% uth=75% cuth=75%

u = usage(getUsage), cu = collectionUsage (getCollectionUsage), uth = usage
threshold %, cuth = collection usage threshold %
my program just keeps allocating string and frees some strings.

1. Why does G1GC doesn't update it's collection usage till 59% whereas in
CMSGC it is updated at 37% itself?

Can someone shed more light on this?

Thanks,
Sundar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/hotspot-gc-dev/attachments/20170628/8ffd4033/attachment.htm>


More information about the hotspot-gc-dev mailing list