igneum/infra/cloud-devnet/experiments/latency.sh
igneum-labs d8dc8c6ba3 infra: cloud devnet (20 nodes), rented GPU bench and seed node scripts; plans for both
infra/cloud-devnet: hcloud (doctl variant) create, builder-VM provision from a git-archive source tarball,
systemd units for igneumd --devnet-suffix with a sparse --addpeer mesh and a CPU trickle miner per node,
stdlib wRPC client, experiments (latency, partition, hop, collect, observer hookup), README with the command
sequence and the Hetzner API prices of 3 Oct 2026.
infra/gpu-bench: RunPod image recipes (CUDA 12.8, ROCm), bundle, run.sh (vectors gate, 10-min raw, sweep,
inline shortcut ratio, nvcc/NVRTC/OpenCL recompile timings, results row, intake upload), bench-log template.
infra/seed-nodes: create-seed (persistent IPv4, firewall), provision on the VM, health check, addPeer from the
Mac over grpcurl, seeds.txt; igneum-seed-1 created at 188.245.5.161 (Hetzner cx23, fsn1).
docs/plans/cloud-devnet.md and docs/plans/seed-nodes.md.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-03 22:01:50 +00:00

37 lines
2.2 KiB
Bash
Executable file

#!/usr/bin/env bash
# Experiment 1a: inter-region RTT and block propagation delay.
# ./experiments/latency.sh [minutes] default 10
# 1. RTT: every node pings every other node (5 pings, 0.2 s apart) in parallel; results/<date>/latency/rtt.tsv and a
# region-pair table.
# 2. Propagation: the block logs run anyway (igneum-blocklog); this waits `minutes`, pulls blocks.tsv from every node
# and joins on the block hash: first arrival anywhere = t0 of that block, per node delay = arrival - t0.
# Clocks: chrony on every VM; the per-node offset is recorded (chronyc tracking) and the join is only as good as it.
. "$(dirname "$0")/../lib/common.sh"
require_nodes
minutes="${1:-10}"
out="$(results_dir_for)/latency"; mkdir -p "$out/nodes"
all_ips=$(cut -f4 "$NODES_FILE" | tr '\n' ' ')
t_start=$(date +%s)000
log "RTT matrix: $(node_count) nodes x $(( $(node_count) - 1 )) targets, 5 pings each"
: > "$out/rtt.tsv"
while IFS=$'\t' read -r name idx reg ip; do
(
nssh "$ip" "for t in $all_ips; do [ \"\$t\" = \"$ip\" ] && continue; r=\$(ping -c 5 -i 0.2 -W 2 \$t 2>/dev/null | awk -F'/' '/rtt|round-trip/ { print \$4\"\t\"\$5\"\t\"\$6 }'); printf '%s\t%s\t%s\n' '$name' \"\$t\" \"\${r:-NA\tNA\tNA}\"; done" 2>/dev/null
) >> "$out/rtt.tsv" &
done < "$NODES_FILE"
wait
log "rtt.tsv: $(grep -c . "$out/rtt.tsv") pairs. Region-pair medians (avg RTT ms):"
python3 "$HERE/experiments/analyze.py" rtt "$out" "$NODES_FILE" | tee "$out/rtt-by-region.md"
log "propagation window: $minutes min from $(date -u +%H:%M:%S) (the miners must be running: ./start.sh miners)"
sleep $(( minutes * 60 ))
t_end=$(date +%s)000
while IFS=$'\t' read -r name idx reg ip; do
mkdir -p "$out/nodes/$name"
nscp "$SSH_USER@$ip:/var/log/igneum/blocks.tsv" "$out/nodes/$name/blocks.tsv" 2>/dev/null || log "no blocks.tsv on $name"
nssh "$ip" "chronyc tracking 2>/dev/null | grep -E 'System time|RMS offset'" > "$out/nodes/$name/chrony.txt" 2>/dev/null || true
done < "$NODES_FILE"
python3 "$HERE/experiments/analyze.py" propagation "$out" "$NODES_FILE" "$t_start" "$t_end" | tee "$out/propagation.md"
printf '%s\tlatency %s min, window %s..%s\n' "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$minutes" "$t_start" "$t_end" >> "$(results_dir_for)/events.log"
log "written: $out/rtt.tsv, rtt-by-region.md, propagation.md"