Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
33 lines
1.4 KiB
Bash
Executable File
33 lines
1.4 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 lifted; LIMITED run again with
|
|
# libp2p's default limit (about 190 inbound connections on 16 GB of RAM).
|
|
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" 5000 "lifted-$n"; done
|
|
for n in $LIMITED; do run "$n" "" "default-$n"; done
|
|
echo "done: $(ls $OUT/*.json | wc -l) runs in $OUT"
|