FOLGMANN

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

Performance Documentation for the Java HotSpot VM
How does garbage collection work?
Generational and concurrent garbage collection
Turbo-charging Java HotSpot Virtual Machine, v1.4.x to Improve the Performance and Scalability of Application Servers
Improving Java Application Performance and Scalability by Reducing Garbage Collection Times and Sizing Memory Using JDK 1.4.1









Letzte Änderung: 2024-03-27 19:03:51
© 2000-2015 by Folgmann EDV-Beratung
Created by XEmacs