Apache ZooKeeper

JVM Garbage Collection Pauses Trigger Session Timeouts

warning
Resource ContentionUpdated Sep 29, 2025

Long GC pauses halt all ZooKeeper threads including heartbeat processing, causing client sessions to expire. Even well-tuned JVMs can experience occasional long pauses that exceed typical session timeout windows.

How to detect:

Monitor JVM GC pause times and frequency. Alert when a single GC pause exceeds 1/3 of the configured session timeout (e.g., >1.6s for 5s timeout), or when cumulative GC time exceeds 5% of wall time over 1 minute.

Recommended action:

Review GC logs to identify problematic GC events. Tune JVM flags to optimize GC for low latency (e.g., use G1GC or ZGC). Ensure heap size is appropriate - not too small (frequent GC) or too large (long GC pauses). Verify heap usage stays below 80% to avoid excessive GC pressure.