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:
2026-11-18 22:46:05 +01:00
co-authored by Claude Sonnet 5.5
parent 130ba5dc65
commit 86668baf5a
10 changed files with 170 additions and 53 deletions
+3 -3
View File
@@ -31,7 +31,7 @@ for (const r of runs) {
const alone = /(\d+) of them have no peer at all/.exec(m.mesh ?? "");
scaling.push({
run: r.name,
limit: m.seed_conns > 0 ? "lifted" : "libp2p default",
limit: m.seed_conns < 0 ? "libp2p default" : "fixed",
nodes: m.nodes,
mesh_s: r1(m.mesh_s),
mesh_complete: m.mesh_complete,
@@ -58,7 +58,7 @@ writeFileSync(join(out, "scaling.json"), JSON.stringify(scaling));
// per-second series of the runs worth looking at over time: the smallest, a middle one and the largest of each limit
const pick = new Set();
for (const limit of ["lifted", "libp2p default"]) {
for (const limit of ["fixed", "libp2p default"]) {
const rs = scaling.filter((x) => x.limit === limit);
if (rs.length) {
pick.add(rs[0].run);
@@ -93,7 +93,7 @@ for (const r of runs) {
if (!lst || !lst.ms?.length) continue;
for (let i = 1; i <= 40; i++) {
const q = i / 40;
arrival.push({ run: r.name, nodes: r.meta.nodes, limit: r.meta.seed_conns > 0 ? "lifted" : "libp2p default", ms: r1(pct(lst.ms, q - 1e-9)), share: Math.round(((q * lst.ms.length) / lst.sent) * 1000) / 10 });
arrival.push({ run: r.name, nodes: r.meta.nodes, limit: r.meta.seed_conns < 0 ? "libp2p default" : "fixed", ms: r1(pct(lst.ms, q - 1e-9)), share: Math.round(((q * lst.ms.length) / lst.sent) * 1000) / 10 });
}
}
writeFileSync(join(out, "arrival.json"), JSON.stringify(arrival));
+5 -4
View File
@@ -5,8 +5,9 @@
# scripts/sim-sweep.sh # the default sweep
# SIZES="100 200" LIMITED="200" scripts/sim-sweep.sh
#
# SIZES run with the seeds' connection limit lifted; LIMITED run again with
# libp2p's default limit (about 190 inbound connections on 16 GB of RAM).
# SIZES run with the seeds' connection limit as shipped (1000 for a --public
# node); LIMITED run again with libp2p's own default (about 190 inbound
# connections on 16 GB of RAM), which is how it was before the limit was set.
cd "$(dirname "$0")/.." || exit 1
OUT=.tmp/sim
mkdir -p "$OUT"
@@ -27,6 +28,6 @@ run() { # run NODES SEEDCONNS LABEL
return 0
}
for n in $SIZES; do run "$n" 5000 "lifted-$n"; done
for n in $LIMITED; do run "$n" "" "default-$n"; done
for n in $SIZES; do run "$n" 0 "fixed-$n"; done # the node's own default for a --public node
for n in $LIMITED; do run "$n" -1 "default-$n"; done # libp2p's default, the way it was before the fix
echo "done: $(ls $OUT/*.json | wc -l) runs in $OUT"