Essential G1 Flags for ML Throughput & Latency

Key G1 GC flags for ML include `-XX:MaxGCPauseMillis` (e.g., 200-500ms target), `-XX:InitiatingHeapOccupancyPercent` (default 45%, adjust for allocation rate), and `-XX:ConcGCThreads` (default ParallelGCThreads/4, increase for shorter concurrent cycles) to optimize pause times and concurrent work.

The top 3

  1. MaxGCPauseMillis: Your Latency Target Setter: The `-XX:MaxGCPauseMillis` flag directly influences G1's strategy to meet a soft pause time goal, typically starting at 200ms, crucial for applications requiring predictable low latency in ML inference.
  2. IHOP's Role: Balancing Concurrent vs. STW Pauses: The `-XX:InitiatingHeapOccupancyPercent` (IHOP), defaulting to 45%, determines when G1's concurrent marking cycle begins; tuning it prevents costly Full GCs (improving latency) while managing concurrent CPU overhead (optimizing throughput).
  3. Parallel vs. Concurrent: G1's CPU Thread Allocation: `ParallelGCThreads` dictates the number of threads for Stop-The-World (STW) GC phases (e.g., Young GC, Mixed GC remark), while `ConcGCThreads` manages threads for concurrent tasks like marking. Increasing `ParallelGCThreads` can shorten STW pauses if CPU is abundant, improving latency, but too many can cause contention. Boosting `ConcGCThreads` can shorten concurrent cycles, reducing the chance of Full GCs, but adds CPU overhead for application threads.

Sources

Open the full topic