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
+25 -1
View File
@@ -1,10 +1,29 @@
#!/usr/bin/env bash
# benchmark_comprehensive.sh — Comprehensive benchmark for fastSyncAI
#
# Compares fastSyncAI against rsync, rclone, unison, and other tools
# Tests different connection counts and settings
#
# Usage:
# ./benchmark_comprehensive.sh [DATA_SIZE_MB] [RUN_COUNT] [LATENCY_MS]
=======
# =============================================================================
# benchmark_comprehensive.sh — Comprehensive benchmark for fastSyncAI
#
# Compares fastSyncAI against rsync, rclone, unison, and other tools
# Tests different connection counts and settings
#
# NOTE: When LATENCY_MS > 0, only fastSyncAI (TCP-based) experiences the network
# latency. rsync, rclone, unison, and cp operate locally and bypass tc netem.
# For fair TCP-based comparison of all tools, use benchmark_network.sh instead.
#
# Usage:
# ./benchmark_comprehensive.sh [DATA_SIZE_MB] [RUN_COUNT] [LATENCY_MS]=============================================================================
# benchmark_comprehensive.sh — Comprehensive benchmark for fastSyncAI
#
# Compares fastSyncAI against rsync, rclone, unison, and other tools
# Tests different connection counts and settings
#
# Usage:
# ./benchmark_comprehensive.sh [DATA_SIZE_MB] [RUN_COUNT] [LATENCY_MS]
#
@@ -175,7 +194,12 @@ run_fastsync() {
output=$(timeout 120 "$CLIENT_BIN" -h "$HOST" -p "$server_port" -s "$SRC_DIR" -n "$nconn" 2>&1) || true
# Wait for client to fully finish sending DONE and server to process all data
sleep 3
# With network latency, 1 connection needs more time
local wait_time=3
if [ "$LATENCY_MS" -gt 0 ] && [ "$nconn" -eq 1 ]; then
wait_time=$(( 3 + LATENCY_MS / 10 + 2 ))
fi
sleep $wait_time
# Signal server to exit (it will finish current transfers and die)
kill "$srv_pid" 2>/dev/null || true
timeout 10 wait "$srv_pid" 2>/dev/null || true