Apache ZooKeeper

Excessive Watch Count Causes Memory and CPU Overhead

warning
Resource ContentionUpdated Feb 6, 2026

A very high watch count (tens of thousands) consumes significant memory and causes latency spikes when many watches fire simultaneously. This is often caused by clients creating watches without proper cleanup.

How to detect:

Monitor zookeeper.watch.count - alert when it exceeds 50,000 watches per server or shows sustained growth over days. Correlate with memory usage and latency spikes during watch trigger events.

Recommended action:

Identify which clients are creating excessive watches by examining connection statistics. Review client application code to ensure watches are removed when no longer needed. Consider implementing watch count limits per client connection if applications cannot be fixed immediately.