Memory Swapping Causes Client Session Expirations
criticalResource ContentionUpdated May 20, 2022
When the OS swaps ZooKeeper JVM memory to disk, it delays heartbeat processing, causing client session timeouts and disconnects. Swap usage is particularly problematic in virtualized and cloud environments.
Technologies:
How to detect:
Monitor OS-level swap usage for ZooKeeper processes. Alert immediately when swap used by ZooKeeper JVM exceeds 0 bytes. This metric should always be zero for healthy operation.
Recommended action:
Immediately increase available RAM, reduce JVM heap size to leave more room for OS cache, or disable swap entirely for ZooKeeper nodes. Review memory allocation to ensure heap + off-heap + OS cache + other processes fit in physical RAM with headroom. In virtualized environments, ensure VM is not overcommitted.