Latency
Enable debug logs, interpret ping latency outputs, and understand the factors affecting peer latency
Overview
To assess the latency and health of your P2P network, you can leverage the built-in ping protocol. This mechanism allows you to measure the round-trip operation timeframe.
The ping protocol is actively running in your network.
Send a ping message to a given peer.
Wait for a response.
Measure the time elapsed during the operation.
The stack logs the latency automatically, assuming the appropriate debug logs are enabled.
Example Logs
When debug logging is enabled, you'll see entries like the following in your logs:
Latency between peers can be influenced by:
Geographical distribution
Network routing
NAT traversal complexity
ISP conditions
Transport layers (WebSockets, QUIC, TCP, etc.)
Enabling Debug Logs
Enable the libp2p:ping
debug namespace. This can be done by setting the following environment variable before starting your node:
For detailed diagnostics (e.g. libp2p:gossipsub
, libp2p:connection-manager
)
Last updated