Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see what garbage collector is running by looking at gc logs?

How can I see what garbage collector (CMS, Parallel and so on) is running by looking at gc logs for minor and major collection? I don't have access to the command line options set to java (the sysadm for the appserver wont let me see them). I do have rather verbose gc logs.

like image 555
user1329339 Avatar asked Nov 01 '12 09:11

user1329339


1 Answers

Exact format of GC messages depends on JVM version and JVM settings. You can see samples at Oracle tutorial about GC tuning.

DefNew is default collector. It's either serial or parallel, which one is chosen depends, again, on JVM version/settings. You can see your default settings in JDK 6 using java -XX:+PrintCommandLineFlags -version. On my system it prints:

-XX:MaxHeapSize=1073741824 -XX:ParallelGCThreads=4 -XX:+PrintCommandLineFlags -XX:+UseParallelGC

which means Parallel GC is DefNew for me. You can check this SO question and one of it's answers references this table, may be it will help you.

UPDATE Default Old Gen GC in JDK 6 is ParallelOldGC, see this enlightening pdf. In particular, you can change Old Gen GC to newer Concurrent-mark-sweep one using -XX:+UseConcMarkSweepGC JVM option.

like image 142
Victor Sorokin Avatar answered Nov 11 '22 23:11

Victor Sorokin