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.

The top 3

  1. MaxGCPauseMillis: The Throughput-Latency Balancing Act: Setting a low `MaxGCPauseMillis` target forces G1 GC to prioritize shorter pauses, often achieved by making the young generation smaller, leading to more frequent garbage collections and a potential reduction in overall application throughput.
  2. G1's Predictive Model: How It Meets MaxGCPauseMillis: G1 GC achieves its soft `MaxGCPauseMillis` target by dynamically adjusting the size of the young generation and employing an adaptive, predictive model based on historical pause times to select which heap regions to collect, prioritizing those with the most reclaimable space.
  3. Top 3 JVM Flags Complementing MaxGCPauseMillis: For fine-tuning G1 GC latency, `InitiatingHeapOccupancyPercent` (IHOP) helps start concurrent cycles earlier, `ParallelGCThreads` controls the number of parallel GC worker threads for stop-the-world phases, and `ConcGCThreads` manages concurrent marking threads that run alongside the application.

Sources

Open the full topic