allmende-sim: record runs as JSON (samples, phases, arrival times); sweep script and graph data; scaling results

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:23:33 +01:00
co-authored by Claude Sonnet 5.5
parent 5db90c2720
commit 130ba5dc65
6 changed files with 321 additions and 3 deletions
+22
View File
@@ -621,6 +621,28 @@ packet loss looks like above TCP), `-hostile` (an attacker with no validators),
| all seeds shut down | the network keeps working (329 of 329 listings); newcomers that remember two live peers of their own region got everything (160 of 160) |
| 300 nodes, 8 regions | 100% delivered (listings p95 75 ms, messages p95 0.8 s, reports p95 0.5 s), all agreed; 1.3 GB heap, 100k goroutines, 137 KB per node |
**How large a network can it carry?** `scripts/sim-sweep.sh` runs growing
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 |
|---|---|---|
| 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 |
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).
Findings (nothing here is fixed yet; see "What is left" in SPECS.md):
1. **Connection limit on the bootstrap node.** libp2p's resource manager caps