http://blogs.sun.com/watt/resource/jvm-options-list.html
or the official Oracle list:
http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html
and the Tagtraum list:
http://www.tagtraum.com/gcviewer-vmflags.html
Also check out the article "Java Performance Tuning, Profiling, and Memory Management" on Dzone by Vikash Ranjan:
http://java.dzone.com/articles/java-performance-tuning
And the last good pointer is the article of Pete Freitag:
http://www.petefreitag.com/articles/gctuning/
I also really liked this JVM deck of Simon Ritter :
http://www.javapassion.com/javase/GC_Performance.pdf
Ritter points out that:
--> Most new objects will die young
--> Concentrate effort on young generation (Eden)
--> Use the right tool for the job (Different GC algorithms for each generation)
Howto read gc.log
After adding the following JVM options:
-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:/tmp/gc.log
You will find in the generated /tmp/gc.log something like:
[GC 34000 kb -> 21000 kb (0.018 sec] (The GC collects the young generation)
[Full GC 60000 kb -> 12000 kb (0.430 sec] (The Full GC collects the old generation, costs more CPU)
To analyse the /tmp/gc.log open it with the tool GCViewer.
Choose the Just-In-Time compiler
-classic (no JIT)
-client (a lot of JIT compiling)
-server (optimized JIT compiling, for production environment)
this JVM option needs to be the first one in the list
JVM options to consider
For JVM performance tuning you will have to choose the
- Young generation option
- Old generation option
For example : Generation | Collector | JVM options | Description |
Young | Serial New | -XX:+UseSerialGC (default until J2EE 1.4) | Single-threaded, stop-the-world, copying collector |
Young | Parallel Scavenge / Throughput | -XX:+UseParallelGC (default JEE 5+) | Multi-threaded, stop-the-world, copying collector (CAN NOT to be used with CMS). Automatically used when -XX:+AggressiveHeap was specified. |
Young | Parallel New | -XX:+UseParNewGC | Multi-threaded, stop-the-world, copying collector CAN be used along with CMS. Automatically used when CMS was specified for Old Gen. |
Old | Serial Old / Mark Sweep Compact | -XX:+UseSerialGC | Single-threaded, stop-the-world, mark-sweep-compact (MSC) collector |
Old | Parallel Old | -XX:+UseParallelOldGC (JEE 6+) | Multi-threaded, stop-the-world, copying collector |
Old | Concurrent Mark-Sweep / Concurrent Low Pause | -XX:+UseConcMarkSweepGC | Concurrent low pause collector that works sharing the application threads. |
-server -Xms2000m -Xmx2000m -Xss512k -XX:+AggressiveHeap -XX:+UseParallelGC -verbose:gc -XX:+PrintGCTimeStamps -XX:+DisableExplicitGC -Xloggc:/tmp/jboss_GC.log
Sets the ratio between young and old generation.
-XX:NewRatio=3 means that the ratio between the young and old generation is 1:3; in other words, the combined size of eden and the survivor spaces will be one fourth of the heap.
Use cases
Q: Which GC to use when I have applications with a very large young generation heaps ?
A: -XX:+UseParallelGC
Monitor your JVM
JConsole
VisualVM
JRockit
JMAP
As you probably still have questions, refer to:
http://www.oracle.com/technetwork/java/hotspotfaq-138619.html