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
Incremental Train Collector


(causes appx. 10% slower overall GC)
Parallel Copying Collector

Parallel Scavenge Collector


-XX:NewSize, -XX:NewRatio, -XX:SurvivorRatio or -Xmn (fixed size)
Old Mark-Compact Collector
Concurrent Collector

Mark-Compact Collector
-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: 2023-11-13 22:12:11
© 2000-2015 by Folgmann EDV-Beratung
Created by XEmacs