p2p: a --public node accepts 1000 inbound connections (--max-conns), instead of libp2p's memory-scaled default
The simulator showed libp2p's default cap (about 190 on 16 GB) stranding newcomers on a bootstrap node: 12 of 200 and 212 of 400 nodes never found a peer. As shipped, the same networks now form and deliver 100% up to 600 nodes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
+22
-20
@@ -626,30 +626,32 @@ networks (8 regions, 3 seeds, 30 listings, 20 messages, 3 reports, 10% churn)
|
||||
and records each as JSON in `.tmp/sim/`; `scripts/sim-report.mjs` turns them
|
||||
into the tables behind the graphs. Result on a 16 GB, 8-core machine:
|
||||
|
||||
| Nodes | Seed limit lifted | libp2p default limit |
|
||||
| Nodes | As shipped (`--public` accepts 1000) | libp2p's own default limit (before the fix) |
|
||||
|---|---|---|
|
||||
| 100 | complete in 3.5 s, 100% delivered | complete in 3.2 s, 100% |
|
||||
| 200 | 6.1 s, 100% (p95 50 ms) | **never completed**: 12 nodes without any peer, 91.8% delivered |
|
||||
| 300 | 9.5 s, 100% (p95 75 ms) | 112 nodes without a peer, 43% delivered |
|
||||
| 400 | 14 s, 100% (p95 97 ms) | 212 nodes without a peer, 16% delivered |
|
||||
| 600 | 24 s, 100% (p95 111 ms) | not run |
|
||||
| 100 | complete in 3.4 s, 100% delivered | complete in 3.2 s, 100% |
|
||||
| 200 | 6.3 s, 100% (p95 57 ms) | **never completed**: 12 nodes without any peer, 91.8% delivered |
|
||||
| 300 | 9.4 s, 100% (p95 79 ms) | 112 nodes without a peer, 43% delivered |
|
||||
| 400 | 14 s, 100% (p95 99 ms) | 212 nodes without a peer, 16% delivered |
|
||||
| 600 | 24.5 s, 100% (p95 117 ms) | not run |
|
||||
|
||||
With the limit lifted, delivery stayed at 100% and agreement held up to 600
|
||||
nodes; time to form the mesh grows roughly with the square of the network
|
||||
size (3.5 s at 100, 24 s at 600), and so does the simulator's cost (2.5 GB
|
||||
heap, 230k goroutines, 255 CPU-seconds at 600). That cost is the sum of all the
|
||||
nodes sharing one machine, so it measures the limit of the simulation as much
|
||||
as of the protocol; 800 nodes was left out to avoid exhausting memory. With
|
||||
the default limit the network stops working where the seeds run out of
|
||||
inbound connections (three seeds hold about 187 each).
|
||||
As shipped, delivery stayed at 100% and agreement held up to 600 nodes; time
|
||||
to form the mesh grows roughly with the square of the network size (3.4 s at
|
||||
100, 24.5 s at 600), and so does the simulator's cost (2.5 GB heap, 230k
|
||||
goroutines, 250 CPU-seconds at 600). That cost is the sum of all the nodes
|
||||
sharing one machine, so it measures the limit of the simulation as much as of
|
||||
the protocol; 800 nodes was left out to avoid exhausting memory. With libp2p's
|
||||
default the network stopped working where the seeds ran out of inbound
|
||||
connections (three seeds held about 187 each).
|
||||
|
||||
Findings (nothing here is fixed yet; see "What is left" in SPECS.md):
|
||||
Findings (see "What is left" in SPECS.md for the open ones):
|
||||
|
||||
1. **Connection limit on the bootstrap node.** libp2p's resource manager caps
|
||||
inbound connections in proportion to memory (about 190 on 16 GB). With 200
|
||||
nodes, 12 never got a single peer; with the limit lifted the mesh formed in
|
||||
6 s. A bootstrap node in a pod with a small memory limit would cap out much
|
||||
sooner. Needs explicit limits on `--public` nodes.
|
||||
1. **Connection limit on the bootstrap node (fixed).** libp2p's resource
|
||||
manager capped inbound connections in proportion to memory (about 190 on 16
|
||||
GB, fewer in a small container): with 200 nodes, 12 never got a single peer.
|
||||
A `--public` node now accepts 1000 inbound connections (`--max-conns`
|
||||
changes it; `-1` restores libp2p's default), and the table above shows the
|
||||
result. Not measured: the memory of a seed holding 1000 connections against
|
||||
the 512 MiB limit in `k8s/base/statefulset.yaml`.
|
||||
2. **No peer scoring.** The attacker stayed connected to all 10 nodes it
|
||||
dialed after sending 500 bad messages. Nothing was stored, but each message
|
||||
still cost every node its validation work.
|
||||
|
||||
Reference in New Issue
Block a user