Skip to main content

Debugging G1 GC

5 replies [Last post]
jfk321
Offline
Joined: 2009-11-17
Points: 0

Hi,

I wonder if anyone can suggest to me how I can go about debugging G1 GC.

We are seeing this happening:

After moving from CMS to G1, my application will suddenly uses up 60-70% of a CPU Core for no good reason. Although this is similar to a supposedly fixed bug (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6870843), I didnt notice memory use kept going up. On the other hand I cannot help but seeing the similarity in terms of high CPU usage.

I cannot predict the time when the issue will happen but I know that if the problem occurs and I force a Full GC (or connect visualVM to it), the Core CPU utilization goes down rightaway.

I am using 1.6u18 b05. The flags I use are:

-server
-XX:+UseAdaptiveSizePolicy
-XX:+UseLargePages
-XX:+AggressiveOpts
-XX:+DoEscapeAnalysis
-XX:+UseBiasedLocking
-XX:+TieredCompilation
-XX:+UseCompressedOops
-XX:+UseStringCache
-XX:+UseFastAccessorMethods
-XX:+UseTLAB
-XX:+ResizeTLAB

-XX:+UnlockExperimentalVMOptions
-XX:+UseG1GC
-XX:+G1ParallelRSetUpdatingEnabled <<< i have tried with or without this
-XX:+G1ParallelRSetScanningEnabled <<< i have tried with or without this

Any suggestion how can I log my observation for Java Bug reporting? visualVM does not seem to register G1's activities.

Thanks,

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
sevenm
Offline
Joined: 2003-06-10
Points: 0

I've seen the same behavior on a Swing app running on Win 7 with jre 1.6.0_18 launched only with -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC options.

Pitty because otherwise the G1 does a very good job in compacting the heap.

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

JDK6u18 has an older version of G1, does the problem still happen with a recent JDK7 build?

ijuma
Offline
Joined: 2005-10-19
Points: 0

JDK6u20 early access release includes a recent HotSpot 17 build, so that's also an option:

http://download.java.net/jdk6/binaries/

Ismael

sevenm
Offline
Joined: 2003-06-10
Points: 0

Hi,

I confirm that with java version "1.6.0_20-ea" the problem went away. Great!

Regards

linuxhippy
Offline
Joined: 2004-01-07
Points: 0

One thing that could probably help would be to run your app with debug/fastdebug builds,
and record stack-traces when the problem occurs (you can use the pstack-utility when using linux).

Another useful thing would probably a oprofile/sysprof profile, to see where all the probably wasted CPU cycles are spent on.

Good luck, Clemens