liveBook · Manning

-XX:ParallelGCThreads

As explained in Troubleshooting Java, Second Edition

-XX:ParallelGCThreads is a JVM option that sets the number of threads used for parallel garbage-collection work during stop-the-world phases.

-XX:ParallelGCThreads sets how many threads the JVM uses for parallel garbage-collection work during stop-the-world phases, including young-generation evacuation. section 11.4.4

Use it when GC logs show long or frequent pauses alongside low worker utilization. Raising the value can distribute cleanup across more CPU cores; setting it too high can consume CPU needed by the application. section 11.4.4

[GC pause (G1 Evacuation Pause) (young), 0.124567 secs]
   Parallel Time: 115.2 ms, Workers: 2 (out of 8 available)
   Eden: 256M->0M(1024M), Survivors: 32M->64M, Heap: 2048M->1024M(4096M)

Inspect the pause duration, worker count, available workers, and heap changes before changing the setting. section 11.4.4

A low-worker pause

A G1 evacuation pause lasting 124.567 milliseconds uses only 2 of 8 available workers. Testing -XX:ParallelGCThreads=6 may improve CPU utilization and reduce pause time, but the result should be checked against application CPU usage. section 11.4.4

How Troubleshooting Java, Second Edition covers it

How deep it goes
Defines the setting, shows its stop-the-world role, and explains low-versus-high trade-offs without detailing JVM thread-selection internals.
Examples
Uses a G1 evacuation-pause log showing two of eight workers and tests -XX:ParallelGCThreads=6.
What it assumes
Interprets basic GC logs and recognizes long pauses, worker counts, CPU utilization, and stop-the-world phases.
What you can do after
Operate/configure the JVM with a tested ParallelGCThreads value and assess its effect on pauses and application CPU usage.
How it connects
Ties parallel GC threads to G1 garbage collection, stop-the-world garbage collection, GC logs, CPU utilization, and pause times.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Troubleshooting Java, Second Edition. The section links point to the parts of the book it draws on.