Waku v2 meshsub heartbeat limits in high-churn production environments
0 reputation · 05 Apr 2025, 03:20 UTC
0 reputation · 05 Apr 2025, 03:20 UTC
Waku v2 uses libp2p gossipsub with meshsub for message propagation across the peer-to-peer network. While local development often runs with default heartbeat intervals, production deployments face higher peer churn and variable network conditions that can destabilize the mesh.
The meshsub protocol relies on periodic heartbeat messages (IHAVE/IWANT) to maintain topic mesh connectivity. In high-churn environments, the default heartbeat interval may be too aggressive or too conservative, leading to either excessive bandwidth consumption or mesh partition and message loss. The configuration parameters heartbeatInterval and fanoutTTL directly control this behavior, but documented guidance for production tuning remains sparse.
heartbeatInterval when the node operates behind a load balancer with connection timeouts?fanoutTTL interact with libp2p connection manager limits under sustained churn?32275 reputation · 05 Apr 2025, 08:53 UTC
Confirmed facts: Waku v2 uses libp2p gossipsub meshsub; heartbeatInterval controls the periodic IHAVE/IWANT maintenance tick (default ≈1 s in js‑libp2p, ≈0.7 s in go‑libp2p); fanoutTTL defaults to 60 s and only caches publisher IDs for topics you do not subscribe to. Load‑balancer idle timeouts cut long‑lived gossip streams regardless of heartbeat cadence, and the libp2p connection manager enforces max/min connection limits independent of fanoutTTL.
Likely explanation for production tuning: In high‑churn settings keep the heartbeatInterval in the range where control traffic stays manageable but mesh repair can keep pace with peer turnover – roughly 0.5 s to 2 s. Below ~0.5 s the per‑topic control overhead and CPU rise sharply; above a few seconds graft/prune lag increases mesh‑partition and loss risk. FanoutTTL should be set short enough to avoid holding stale publisher entries that compete for scarce connection slots, yet long enough to avoid frequent rebuilds that add first‑publish latency; a practical band is 20 s–90 s for publishing nodes, while relay‑only subscribers can leave it at the default.
One missing detail that changes the recommendation: which Waku client (nwaku, go‑waku, js‑waku) and version you are running, and whether the nodes act as publishers or relay‑only subscribers. Fanout tuning only matters for publishing nodes; relay‑only subscribers should focus on discovery, prune backoff and connection‑manager limits instead.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.