G1 Thread Allocation: Latency vs. Throughput for ML

For low-latency ML applications, increasing `ParallelGCThreads` minimizes STW pauses, while high-throughput batch ML often benefits from balancing `ConcGCThreads` to reduce concurrent overhead and prevent full GCs.

The top 3

  1. ParallelGCThreads: Balancing ML Throughput: For ML workloads prioritizing high throughput, `-XX:ParallelGCThreads` (often set to the number of available CPU cores) controls threads for stop-the-world young GCs, reducing pause times for these events and boosting overall application throughput.
  2. ConcGCThreads: Low-Latency ML Tuning: To minimize latency in ML inference, `-XX:ConcGCThreads` (typically 2-4 for general workloads) manages concurrent marking threads, speeding up collection and reducing the risk of full GCs that cause long application pauses.
  3. G1ConcRefinementThreads: Refining ML Pauses: The `-XX:G1ConcRefinementThreads` flag (often 1-4) optimizes remembered set processing during concurrent marking, reducing overhead and contributing to more predictable, lower latency for ML applications.

Sources

Open the full topic