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
34 lines
1.5 KiB
Bash
Executable File
34 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# How large a network can the protocol carry? Runs allmende-sim at growing sizes
|
|
# and records every run as JSON in .tmp/sim/ (see scripts/sim-report.mjs for the graphs).
|
|
#
|
|
# scripts/sim-sweep.sh # the default sweep
|
|
# SIZES="100 200" LIMITED="200" scripts/sim-sweep.sh
|
|
#
|
|
# 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"
|
|
go build -o .tmp/allmende-sim ./cmd/allmende-sim || exit 1
|
|
|
|
SIZES=${SIZES:-"50 100 200 300 400 600 800"}
|
|
LIMITED=${LIMITED:-"100 200 300 400"}
|
|
|
|
run() { # run NODES SEEDCONNS LABEL
|
|
local n=$1 conns=$2 label=$3
|
|
local regions=8; [ "$n" -lt 100 ] && regions=3
|
|
echo "== $label: $n nodes, seed limit ${conns:-default}"
|
|
.tmp/allmende-sim -nodes "$n" -regions $regions -seeds 3 -listings 30 -messages 20 -reports 3 -churn 0.1 \
|
|
-timeout 60s ${conns:+-seed-conns $conns} -json "$OUT/$label.json" > "$OUT/$label.txt" 2>&1
|
|
local code=$?
|
|
grep "^ mesh\|^ listing\|^ report \|^ message " "$OUT/$label.txt" | cut -c1-200
|
|
[ $code -ne 0 ] && echo " exit code $code (see $OUT/$label.txt)"
|
|
return 0
|
|
}
|
|
|
|
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"
|