diff options
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 |
