GC Trade-offs: Throughput vs. Latency in ML

Garbage collectors present a trade-off between throughput and latency. G1 prioritizes high throughput, often serving as the default for balanced performance, but its pause times can be less predictable (50-500ms). ZGC and Shenandoah prioritize ultra-low latency, achieving sub-millisecond to single-digit millisecond pauses, but this comes at the cost of slightly higher CPU overhead (ZGC and Shenandoah can use 7-15% more CPU than G1 due to concurrent operations) and potentially a small reduction in overall application throughput.

Sources

Open the full topic