Fix: Multiple benchmark script bugs

- benchmark_network.sh:
  - Removed info() call in run_fastsync that contaminated output parsing
  - Reduced excessive wait times (was up to 66s for WAN)
  - More reasonable dynamic wait based on latency
- compare_rsync.sh:
  - Fixed hardcoded -n 4 connections, now accepts connection count parameter
  - Replaced slow md5sum verification with fast file count+size check
  - Added latency-aware wait times for 1 connection
- benchmark.sh:
  - Added sync after client to ensure disk writes complete
  - Added EXIT trap for tc netem cleanup and process cleanup
  - Removed duplicate manual cleanup
- benchmark_comprehensive.sh:
  - Added latency-aware wait times for 1 connection in run_fastsync
  - Added documentation note that rsync/cp bypass tc netem (use benchmark_network.sh for fair TCP comparison)

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
taptap
2026-06-24 16:35:31 +02:00
parent 3a3482da71
commit 83f129314e
4 changed files with 63 additions and 18 deletions
+12 -2
View File
@@ -41,6 +41,16 @@ ok() { echo -e "${GREEN}✓ $*${RESET}"; }
[ -x "$SERVER_BIN" ] || die "Server binary not found: $SERVER_BIN — run 'make' first."
[ -x "$CLIENT_BIN" ] || die "Client binary not found: $CLIENT_BIN — run 'make' first."
cleanup() {
if [ "$LATENCY_MS" -gt 0 ]; then
sudo tc qdisc del dev lo root 2>/dev/null || true
fi
pkill -f "fastsync_server" 2>/dev/null || true
pkill -f "fastsync_client" 2>/dev/null || true
rm -rf "$DATA_DIR" "$DEST_DIR"
}
trap cleanup EXIT
# ── Generate test data ────────────────────────────────────────────────────────
generate_data() {
info "Generating test data (~50 MB mixed tree)..."
@@ -105,6 +115,7 @@ run_pass() {
kill "$srv_pid" 2>/dev/null
wait "$srv_pid" 2>/dev/null
sync # Ensure all writes are flushed to disk
# Parse the machine-readable BENCH: line
local ms mbs
@@ -204,6 +215,5 @@ for i in "${!CONNECTIONS[@]}"; do
done
echo ""
ok "Benchmark done. Cleaning up..."
rm -rf "$DATA_DIR" "$DEST_DIR"
ok "Benchmark done."
echo ""