You can set a number of threads for GC to use:
-XX:ParallelGCThreads=xxx, where xxx represents the number of threads for a garbage collector to use.
JVM allows you to tune it’s behavior during garbage collection. We can control the number of garbage collector threads with the command-line option -XX:ParallelGCThreads. Because multiple garbage collector threads are participating in a minor collection, some fragmentation is possible due to promotions from the young generation to the tenured generation during the collection. Each garbage collection thread involved in a minor collection reserves a part of the tenured generation for promotions and the division of the available space into these "promotion buffers" can cause a fragmentation effect. Reducing the number of garbage collector threads and increasing the size of the tenured generation will reduce this fragmentation effect.
The default value varies with the platform on which the JVM is running.
TODO link ParallelGCThreads, MaxGCPauseMillis , GCTimeRatio, MinHeapFreeRatio, MaxHeapFreeRatio, Xmx, Xms, UseSerialGC, USeParNewGC, UseParallelGC, UseZGC
- Garbage collection tuning
- Garbage collectors documentation
- Quick start on Java GC
- Oracle’s documentation
If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your insights will help the entire 10+ million java developer community to develop one standard source of documentation for all the JVM arguments.