G1GC doesn't clean WeakReference at mixed gc in some situation?

koji Lin koji.lin at gmail.com
Mon Mar 6 23:29:19 UTC 2017


Hi

Local environment is I want to reproduce in none production
environment(Macbook & linux VM with oracle jdk 1.8.0_92).
So try to write some similar WeakReference code as LatencyUtils, but every
time mix gc can clear WeakReference instances in local environment.

Lettuce is redis client, it has built in latency metrics which uses
LatencyUtils, I disable this feature and successfully avoid full GC.

koji

On Mon, Mar 6, 2017 at 6:07 PM koji Lin <koji.lin at gmail.com> wrote:

> My server is using 1.8.0_92 on CentOS 6.7, gc param is '-Xms16g -Xmx16g
> -XX:+UseG1GC'. So the default InitiatingHeapOccupancyPercent is 45,
> G1HeapWastePercent is 5 and G1MixedGCLiveThresholdPercent is 85. My
> server's mixed gc starts from 7.2GB, but it clean less and less, finally
> old gen keeps larger than 7.2GB, so it's always try to do concurrent mark.
> Finally all heap are exhausted and full GC occurred,. After full gc, old
> gen used is under 500MB.
>
> https://i.stack.imgur.com/mzDlu.png
>
> I dumped the heap from another machine with -Xmx4G.I used lettuce as my
> redis client, and it has tracking featured using LatencyUtils. It make
> LatencyStats(which contains some long[] with near 3000 elements)
> instances weak referenced every 10 mins(Reset latencies after publish is
> true by default,
> https://github.com/mp911de/lettuce/wiki/Command-Latency-Metrics). So it
> will make lots of WeakReference of LatencyStats after long time.
>
> Before Full GC.
>
> https://i.stack.imgur.com/KRdOL.png
> https://i.stack.imgur.com/wboak.png
> https://i.stack.imgur.com/vGnmF.png
>
> After Full GC.
> https://i.stack.imgur.com/P0XJV.png
>
> Currently I don't need tracking from lettuce, so just disable it and it
> doesn't have full gc anymore. But want to know why mixed gc doesn't clear
> them.
>
> And I tried in local environment too, but can't reproduce at local
> environment.
>
> Thanks.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/hotspot-gc-use/attachments/20170306/b4681d3e/attachment.html>


More information about the hotspot-gc-use mailing list