Useful Java memory and GC info
According to Visualizing Java Garbage Collection by Ben Evans:
-Xms=-Xmxis no longer needed (setXmsto a reasonable value or omit it altogether; use -Xmx to limit maximum)- flags needed to produce useful GC logs:
-verbose:gc- -
Xloggc:path-to-file(ensure you have enough space, can create logs over 1 GB) -XX:+PrintGCDetails(can/should be used to replace -verbose:gc, yet he said all 4 flags are needed)-XX:+PrintTenuringDistribution
From Everything I Ever Learned about JVM Performance Tuning @twitter by Attila Szegedi (now working for Oracle):
-
Throughput collectors: minimise total time spent in GC, at the expense of responsiveness (less frequent, but long pauses)
-XX:+UseSerialGC-XX:+UseConcMarkSweepGC-XX:+UseParallelGC-XX:+UseParallelOldGC- Automatic tuning for throughput collectors (not for bulk services, but work pretty well in most other cases):
-XX:+UseAdaptiveSizePolicy-XX:MaxGCPauseMillis=...-XX:GCTimeRatio=...
-
Low-pause collectors (shorter pauses, but sum of GC times higher than with throughput collectors)
-XX:+UseConcMarkSweepGC(try if throughput + automatic tuning is not good enough)-XX:+UseG1GC(note: according to Ben Evans, it is supported but not recommended by Oracle
-
Recommends diagnostic option
-XX:+PrintHeapAtGCin addition to those suggested by Ben Evans
More presentations to extract info from (TODO): http://www.infoq.com/presentations/JVM-Performance-Tuning-twitter-QCon-London-2012 http://www.infoq.com/presentations/Java-GC-Azul-C4 (lots of info on GC, not just Azul’s)