synapse
A component of the AienOS ecosystem.
Brought by drakestapleton
synapse / evidence / swarm-board / RULE.md
| 1 | # Swarm board bench: the rule (fixed before the measurement run) |
| 2 | |
| 3 | Committed before `scripts/board-bench.sh` is run for the record. Changing this file after |
| 4 | the run invalidates the run. |
| 5 | |
| 6 | ## Question |
| 7 | |
| 8 | How long does a message take from "a writer starts sending it" to "the addressed agent has |
| 9 | it in hand", on the board versus on our own pre-board flow, at 1, 4, 8 and 32 concurrent |
| 10 | writers? How close is the board to the disk's fsync floor? |
| 11 | |
| 12 | Only our own two flows are compared. No outside system is measured or cited. |
| 13 | |
| 14 | ## Flows (same host, same disk, same workload) |
| 15 | |
| 16 | - **board**: writer runs `synapse-coord board post --to sub ...` (release build). The |
| 17 | subscriber runs one `synapse-coord board watch --follow TOTAL --stamp` that waits on its |
| 18 | wake socket and stamps each event when it reads it. |
| 19 | - **pre-board**: writer runs `agent-mail send <w> sub <msg>`, which writes the mail file and |
| 20 | runs `crumb whisper` (crumb.c, the pinned tool). The receiver is the best case for the old |
| 21 | flow: a busy loop of `agent-mail peek sub`, `crumb sniff sub <dir>`, `agent-mail read sub` |
| 22 | with no sleep, stamping each message when `read` returns it. `HOME` is a temporary |
| 23 | directory so the real `~/shared/agents/inbox` is never touched; `CRUMB_COORD_ROOT` is |
| 24 | temporary; `crumb` is put on `PATH` through a temporary bin directory. |
| 25 | - Excluded from both, said out loud: the orchestrator's repost of a message to other agents |
| 26 | (an LLM turn) that the pre-board flow needs and the board removes. Including it would only |
| 27 | add seconds to the pre-board side. |
| 28 | |
| 29 | ## Workload |
| 30 | |
| 31 | 128 messages per run, split evenly over W writers: W=1 (128 each), 4 (32), 8 (16), 32 (4). |
| 32 | Each writer sends its messages one after another; all writers start together. Every message |
| 33 | carries a unique key `w<writer>-<n>`. One run per (flow, W). |
| 34 | |
| 35 | ## Measurements (all host-observed) |
| 36 | |
| 37 | - latency per message = receiver stamp minus the writer's stamp taken immediately before it |
| 38 | invokes the send command (bash `$EPOCHREALTIME`, the receiver's `recv_unix_ns` or |
| 39 | `$EPOCHREALTIME`). Both flows include process start of the send command. |
| 40 | - p50 and p95 of latency, delivered count, duplicates, wall time of the run. |
| 41 | - fsync floor: `dd bs=512 count=500 oflag=dsync` on the same filesystem, run by the script |
| 42 | before the measurements (t_fsync = dd time / 500). A board post is acknowledged after two |
| 43 | serial fsync rounds (journal; then table and indexes in one parallel group), so the floor |
| 44 | for one post's latency is 2 x t_fsync. The writer lock is never held across an fsync |
| 45 | (group commit), so concurrent posts share flushes and the floor does not grow with W. |
| 46 | Reported: floor / p50 at each W (1.0 would be the disk's limit). |
| 47 | - energy: package energy meter `hwmon aien_spbm energy1 (pkg)` in microjoules, read at the |
| 48 | start and end of each run; whole-package, so background load on the host is included and |
| 49 | is reported alongside as the idle reading over 5 s before the runs. |
| 50 | |
| 51 | ## Verdict rule |
| 52 | |
| 53 | The board **PASSES** when, at every W in {1, 4, 8, 32}: |
| 54 | |
| 55 | 1. it delivers 128 of 128 messages with no duplicate, and |
| 56 | 2. its p50 latency is at most the pre-board flow's p50 latency. |
| 57 | |
| 58 | Otherwise it **FAILS**, and the failing W and numbers are reported as they are. p95, the |
| 59 | fraction of the fsync floor and energy are reported but do not decide the verdict. The |
| 60 | pre-board flow does not fsync its mail files, so it is not durable; the board is. That |
| 61 | difference is reported, not corrected for. |