diff options
| author | tv <tv@krebsco.de> | 2026-12-01 13:19:32 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-12-01 13:19:32 +0000 |
| commit | 6d3dbcb129b67152c89bbbe2a7dad98b071bf838 (patch) | |
| tree | 8f92769b83f802950e0cc0b42be89653c74b2037 /docs/operations.md | |
| parent | 82bb426dcd22268a960d35d7b8c947b864a6ddf5 (diff) | |
Two options for a node on a machine that should idle
--libp2p-ping-interval: how often libp2p pings each open connection,
15 s unless given, 0 for once as it opens. The pings keep no connection
open and close none; continuum takes each connection's round trip from
them, to keep the fastest of several to one peer.
--worker-threads: how many threads take the node's work in turns, as
many as the machine has cores unless given. The runtime is built from
the configuration, so the count is set as the node starts.
Each wakes the node's threads less often; docs/operations.md, An idle
node, says what to choose, and what was measured.
Diffstat (limited to 'docs/operations.md')
| -rw-r--r-- | docs/operations.md | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/operations.md b/docs/operations.md index 0777c52..e3355e5 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -331,6 +331,36 @@ And from the log, at warn or error: * `Peer speaks another wire version: …; ignoring its messages`: a node on another build; the message names both versions, and whether to upgrade this node or that one. +## An idle node + +A node that nothing is written to still wakes: for its keepalives (`--keepalive`, two +per neighbour and interval), for what it checks once a minute (its entry in the member +list, whom it reaches, its clock against its peers'), and for its transports' own +timers. Each time, some of its threads wake. On a machine that should sleep between +those (a laptop, a small server that does other things), two options make it less: + +* **`--worker-threads COUNT`**: how many threads take the node's work in turns. As + many as the machine has cores unless given; whatever wakes the node may wake several + of them, as they hand work to each other. What takes long (reading and saving the + document, judging a store's events, a remake's snapshot) runs on threads of its own + beside them, started as needed and ended when idle, so few worker threads don't make + those wait. The count is set as the node starts: a restart changes it. + * **2** suits most nodes: a member of a swarm with little writing, on a machine with + other work. + * **The default** suits a node that serves many API clients or streams at once, or + relays for many peers: there, more threads take more at a time. + * **1** works, but one piece of work that takes long holds up everything else, + keepalives among it: not below 2 without a reason. +* **`--libp2p-ping-interval DURATION`**: how often libp2p pings each connection; `0` + for once only ([`transports.md`](transports.md), [Pings](transports.md#pings)). + +Measured here, three nodes on one machine of 12 cores over libp2p (TCP), nothing +written, each node's thread wakeups a second over a minute and a half: 4 to 6 as +shipped; 3 to 5 with two worker threads or without pings; 2 to 3 with both. The +figures move from one minute to the next, so take them for their order, not their +digits. `top -H -p PID` shows the threads (`tokio-rt-worker`, and `futures-timer`, +libp2p's), and `/proc/PID/task/*/status` their `voluntary_ctxt_switches`. + ## What a node uses * **Memory**: the document with its history (Automerge holds more in memory than |
