G1gc compaction algorithm

Thomas Schatzl thomas.schatzl at oracle.com
Thu Jul 17 08:02:18 UTC 2014


Hi,

  some parameter analysis:

On Wed, 2014-07-16 at 11:19 +0300, Martin Makundi wrote:
> Hi!
>
> Here's today's log from today's first Full GC.
>
> 81.22.250.165/log

(From the logs: after full gc we have 12g occupied space - let's assume
that is the live set size for now).

> Our app parameters:
>
> -server -XX:InitiatingHeapOccupancyPercent=0 -XX:
> +UnlockExperimentalVMOptions -XX:G1MixedGCLiveThresholdPercent=10

G1MixedGCLiveThresholdPercent is the upper threshold for determining
whether old gen regions can be collected. I.e. only old regions less
than 10% occupied are collected ever.

Which means, you are going for an "expected" heap size of 120G (12G *
100 / G1MixedGCLiveThresholdPercent) - which obviously does not fit into
30G of heap. The result is inevitable full gcs.

(The documentation can be read both ways I think)

Just setting the default (65) will give a more reasonable "expected"
heap size. (~20G)

Depending on length and amount of humongous allocation bursts, you also
want to increase -XX:InitiatingHeapOccupancyPercent to something larger
than G1MixedGCLiveThresholdPercent, otherwise concurrent marking will
run all the time. You may also need to increase
G1MixedGCLiveThresholdPercent if this buffer of 10G is too small.

>  -XX:G1OldCSetRegionThresholdPercent=85 -Xss4096k -XX:MaxPermSize=512m
> -XX:G1HeapWastePercent=1 -XX:PermSize=512m -Xms20G -Xmx30G -Xnoclassgc

-Xnoclassgc disables all class unloading, even during full gc. If you
notice increasing "Ext root scan time" over time, this setting is set
wrongly. Note that 7u55 can only do class unloading at full gc. Only
8u40 and later will also do this at concurrent mark.

>  -XX:-OmitStackTraceInFastThrow -XX:+UseNUMA -XX:
> +UseFastAccessorMethods -XX:ReservedCodeCacheSize=128m
> -XX:-UseStringCache -XX:+UseGCOverheadLimit -Duser.timezone=EET -XX:
> +UseCompressedOops -XX:+DisableExplicitGC -XX:+AggressiveOpts
> -XX:CMSInitiatingOccupancyFraction=90 -XX:+ParallelRefProcEnabled -XX:

You can remove CMSInitiatingOccupancyFraction. It does not have an
effect with G1.

> +UseAdaptiveSizePolicy -XX:MaxGCPauseMillis=75
> -XX:G1MixedGCCountTarget=80 -XX:+UseG1GC -XX:G1HeapRegionSize=5M

G1HeapRegionSize must be a power of two. I think G1 will either round
this to either 4M or 8M - check with -XX:+PrintFlagsFinal.

>  -XX:GCPauseIntervalMillis=1000 -XX:+PrintGCDetails -XX:+PrintHeapAtGC

MaxGCPauseMillis=75 in combination with GCPauseIntervalMillis=1000 seems
to be a tough target, at least for 7uX. Does your application really
need such a low pause time? It may be achievable.

>From the log, already collecting the young generation breaks that pause
time goal. Try -XX:G1NewSizePercent=1 to allow smaller young generation
sizes.

>  -XX:+PrintAdaptiveSizePolicy -XX:+PrintGCDateStamps -XX:+PrintGC
> -Xloggc:gc.log

Thanks,
  Thomas





More information about the hotspot-gc-use mailing list