Parallel Garbage Collector
- sometimes called Throughput Collectors
- uses multiple threads for managing heap space
- but it freezes other application threads while performing GC
If we use this GC, we can specify maximum garbage collection threads and pause time, throughput, and footprint (heap size).
- The numbers of garbage collector threads can be controlled with the command-line option
-XX:ParallelGCThreads=<N>
- The maximum pause time goal (gap [in milliseconds] between two GC) is specified with the command-line option
-XX:MaxGCPauseMillis=<N>
- The time spent doing garbage collection versus the time spent outside of garbage collection is called the maximum throughput target and can be specified by the command-line option
-XX:GCTimeRatio=<N>
To enable Parallel Garbage Collector, we can use the following argument:
java -XX:+UseParallelGC -jar Application.java