Fix: 1-connection failures and improve benchmark speed
- Fixed port conflict: FASTSYNC_PORT changed from 19399 to 19410 (19399+1=19400 conflicted with RSYNC_PORT=19400 on 1-connection runs) - Reduced defaults: DATA_SIZE_MB 100->50, RUN_COUNT 3->1 (faster benchmarks) - Improved wait times: data-size-aware, much longer for 1 connection - Increased timeout: 300s -> 600s for client - Better server startup: sleep 1 (was 0.5s) - Better sync: sleep 2 after sync (was sleep 1 + sync + sleep 1) Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
+15
-16
@@ -25,8 +25,8 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
# ── Defaults ──────────────────────────────────────────────────────────────
|
# ── Defaults ──────────────────────────────────────────────────────────────
|
||||||
DATA_SIZE_MB=${2:-100}
|
DATA_SIZE_MB=${2:-50}
|
||||||
RUN_COUNT=${3:-3}
|
RUN_COUNT=${3:-1}
|
||||||
SCENARIO="${1:---lan}"
|
SCENARIO="${1:---lan}"
|
||||||
|
|
||||||
# ── Parse scenario ────────────────────────────────────────────────────────
|
# ── Parse scenario ────────────────────────────────────────────────────────
|
||||||
@@ -59,7 +59,7 @@ case "$SCENARIO" in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# ── Ports ────────────────────────────────────────────────────────────────
|
# ── Ports ────────────────────────────────────────────────────────────────
|
||||||
FASTSYNC_PORT=19399
|
FASTSYNC_PORT=19410
|
||||||
RSYNC_PORT=19400
|
RSYNC_PORT=19400
|
||||||
HOST="127.0.0.1"
|
HOST="127.0.0.1"
|
||||||
|
|
||||||
@@ -227,28 +227,27 @@ run_fastsync() {
|
|||||||
|
|
||||||
"$SERVER_BIN" -p "$port" -d "$dst" >/dev/null 2>&1 &
|
"$SERVER_BIN" -p "$port" -d "$dst" >/dev/null 2>&1 &
|
||||||
local spid=$!
|
local spid=$!
|
||||||
sleep 0.5
|
sleep 1
|
||||||
|
|
||||||
local output
|
local output
|
||||||
output=$(timeout 300 "$CLIENT_BIN" -h "$HOST" -p "$port" -s "$SRC_DIR" -n "$nconn" 2>&1) || true
|
output=$(timeout 600 "$CLIENT_BIN" -h "$HOST" -p "$port" -s "$SRC_DIR" -n "$nconn" 2>&1) || true
|
||||||
|
|
||||||
# With network latency, wait for all data to be written and synced to disk
|
# With network latency, wait for all data to be written and synced to disk
|
||||||
# Base wait: proportional to latency (round-trip * 2 for safety margin)
|
# For 1 connection: much more time needed as data is sequential
|
||||||
# Connection factor: more connections = faster transfer = less extra wait needed
|
# For high latency: extra margin for TCP retransmissions and jitter
|
||||||
# 1 connection needs more time as data is sent sequentially
|
local wait_time=5
|
||||||
local base_wait=$(( LATENCY_MS / 10 ))
|
if [ "$nconn" -eq 1 ]; then
|
||||||
[ "$base_wait" -lt 2 ] && base_wait=2
|
wait_time=$(( 15 + LATENCY_MS / 5 + (DATA_SIZE_MB / 20) ))
|
||||||
local conn_factor=$(( 10 / nconn ))
|
else
|
||||||
local wait_time=$(( base_wait + conn_factor + 3 ))
|
wait_time=$(( 5 + LATENCY_MS / 10 + (DATA_SIZE_MB / 50) ))
|
||||||
[ "$wait_time" -lt 5 ] && wait_time=5
|
fi
|
||||||
[ "$nconn" -eq 1 ] && wait_time=$(( wait_time + LATENCY_MS / 20 + 3 ))
|
[ "$wait_time" -lt 10 ] && wait_time=10
|
||||||
|
|
||||||
sleep $wait_time
|
sleep $wait_time
|
||||||
kill "$spid" 2>/dev/null || true
|
kill "$spid" 2>/dev/null || true
|
||||||
wait "$spid" 2>/dev/null || true
|
wait "$spid" 2>/dev/null || true
|
||||||
sync
|
sync
|
||||||
sleep 1
|
sleep 2
|
||||||
sync
|
|
||||||
|
|
||||||
local ms=$(echo "$output" | grep -oP 'ms=\K[0-9.]+' || echo "0")
|
local ms=$(echo "$output" | grep -oP 'ms=\K[0-9.]+' || echo "0")
|
||||||
local mbs=$(echo "$output" | grep -oP 'throughput_mbs=\K[0-9.]+' || echo "0")
|
local mbs=$(echo "$output" | grep -oP 'throughput_mbs=\K[0-9.]+' || echo "0")
|
||||||
|
|||||||
Reference in New Issue
Block a user