Java Garbage Collection Tuning
J2SE 1.4.1 and later versions offer several options in order to tune the
garbage collection of Java Virtual Machine (JVM) even for multiprocessing
environments. The intention is to minimize pauses (delay) and/or maximize
throughput. It depends on the requirements of your application which of
the JVM garbage collection settings would be of help. However there are
some general rules of thumb for choosing the best matching algorithm.
|
Default Collectors |
Low Pause Collectors |
Throughput Collectors |
Heap Sizes |
Generation |
|
1 CPU |
2+ CPUs |
2+ CPUs and 1GB+ Heapsize |
|
Young |
Copying Collector default |
Incremental Train Collector
-Xincgc
(causes appx. 10% slower overall GC) |
Parallel Copying Collector
-XX:+UseParNewGC |
Parallel Scavenge Collector
-XX:+UseParallelGC -XX:+UseAdaptiveSizePolicy
or -XX:+AggressiveHeap
|
-XX:NewSize, -XX:NewRatio, -XX:SurvivorRatio or
-Xmn (fixed size) |
Old |
Mark-Compact Collector default |
Concurrent Collector
-XX:+UseConcMarkSweepGC |
Mark-Compact Collector default |
-Xms, -Xmx |
Permanent |
Can be turned off with -Xnoclassgc. Use with care! |
-XX:PermSize, -XX:MaxPermSize |
Web Resources
|
|
|