mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-05 12:57:42 +00:00
fix(tooling): harden internode transport benchmark setup (#3037)
* refactor(config): centralize internode transport constants * fix(bench): guard all ripgrep calls behind dry-run check Move require_cmd rg and metrics collection inside the non-dry-run path so that --dry-run works on hosts without rg installed. * feat(tooling): cross-platform protoc setup for Linux and macOS Make install-protoc.sh support Linux (x86_64, aarch64) alongside macOS, and bump CI protoc from 29.3 to 33.1 to match the version required by the gproto build script. * fix(bench): record internode baseline error counts * fix(skill): correct YAML frontmatter formatting for release-version-bump * chore(ci): bump protoc version to 34.1 * fix(tooling): bump protoc 33.1 to 34.1 in install script, restore SKILL.md description --------- Co-authored-by: Henry Guo <marshawcoco@users.noreply.github.com>
This commit is contained in:
+30
-10
@@ -1,22 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install protoc 33.1 on macOS
|
||||
# Install protoc 34.1 on macOS and Linux
|
||||
|
||||
set -e
|
||||
|
||||
PROTOC_VERSION="33.1"
|
||||
PROTOC_VERSION="34.1"
|
||||
ARCH=$(uname -m)
|
||||
INSTALL_DIR="${HOME}/.local/bin"
|
||||
PROTOC_BIN="${INSTALL_DIR}/protoc"
|
||||
|
||||
# Select download URL based on architecture
|
||||
if [ "$ARCH" = "arm64" ]; then
|
||||
# Apple Silicon (M1/M2/M3)
|
||||
PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-osx-aarch_64.zip"
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
# Intel Mac
|
||||
PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-osx-x86_64.zip"
|
||||
# Detect OS
|
||||
OS="$(uname -s)"
|
||||
|
||||
# Select download URL based on OS and architecture
|
||||
if [ "$OS" = "Darwin" ]; then
|
||||
if [ "$ARCH" = "arm64" ]; then
|
||||
# Apple Silicon (M1/M2/M3)
|
||||
PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-osx-aarch_64.zip"
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
# Intel Mac
|
||||
PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-osx-x86_64.zip"
|
||||
else
|
||||
echo "Error: Unsupported macOS architecture $ARCH"
|
||||
exit 1
|
||||
fi
|
||||
elif [ "$OS" = "Linux" ]; then
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip"
|
||||
elif [ "$ARCH" = "aarch64" ]; then
|
||||
PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-aarch_64.zip"
|
||||
else
|
||||
echo "Error: Unsupported Linux architecture $ARCH"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Error: Unsupported architecture $ARCH"
|
||||
echo "Error: Unsupported OS $OS"
|
||||
echo "On Windows, install protoc via:"
|
||||
echo " choco install protoc --version=${PROTOC_VERSION}"
|
||||
echo " or download from https://github.com/protocolbuffers/protobuf/releases"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ setup_output() {
|
||||
OUT_DIR="target/bench/internode-transport-$(date +%Y%m%d-%H%M%S)"
|
||||
fi
|
||||
mkdir -p "${OUT_DIR}"
|
||||
echo "scenario,endpoint,workload,concurrency,size,status,throughput,requests_per_sec,avg_latency,log_file,run_dir" > "${OUT_DIR}/summary.csv"
|
||||
echo "scenario,endpoint,workload,concurrency,size,status,throughput,requests_per_sec,avg_latency,error_count,log_file,run_dir" > "${OUT_DIR}/summary.csv"
|
||||
if [[ -n "${INTERNODE_METRICS_URL}" ]]; then
|
||||
echo "scenario,workload,concurrency,size,metric,operation,before,after,delta" > "${OUT_DIR}/internode_metric_deltas.csv"
|
||||
fi
|
||||
@@ -253,7 +253,7 @@ append_object_summary() {
|
||||
awk -F',' -v scenario="${scenario}" -v endpoint="${endpoint}" -v workload="${workload}" -v run_dir="${run_dir}" '
|
||||
NR == 1 { next }
|
||||
{
|
||||
printf "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s\n", scenario, endpoint, workload, $3, $1, $4, $5, $6, $7, $8, run_dir
|
||||
printf "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s\n", scenario, endpoint, workload, $3, $1, $4, $5, $6, $7, $8, $9, run_dir
|
||||
}
|
||||
' "${src}" >> "${OUT_DIR}/summary.csv"
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ setup_output() {
|
||||
fi
|
||||
mkdir -p "$OUT_DIR"
|
||||
SUMMARY_CSV="$OUT_DIR/summary.csv"
|
||||
echo "size,tool,concurrency,status,throughput,requests_per_sec,avg_latency,log_file" > "$SUMMARY_CSV"
|
||||
echo "size,tool,concurrency,status,throughput,requests_per_sec,avg_latency,error_count,log_file" > "$SUMMARY_CSV"
|
||||
}
|
||||
|
||||
resolve_bucket() {
|
||||
@@ -214,6 +214,27 @@ collect_metrics() {
|
||||
echo "${throughput:-N/A},${reqps:-N/A},${latency:-N/A}"
|
||||
}
|
||||
|
||||
collect_error_count() {
|
||||
local log_file="$1"
|
||||
local count
|
||||
|
||||
count="$(
|
||||
{ rg -io '(errors?|failures?)[[:space:]:=]+[0-9]+' "$log_file" || true; } \
|
||||
| awk '{ value = $0; gsub(/[^0-9]/, "", value); if (value != "") sum += value } END { if (NR > 0) print sum }'
|
||||
)"
|
||||
if [[ -n "$count" ]]; then
|
||||
echo "$count"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "$TOOL" == "warp" ]]; then
|
||||
count="$(rg -c 'warp: <ERROR>' "$log_file" || true)"
|
||||
else
|
||||
count="$(rg -ci '(^|[[:space:]])(error|failed|failure)(:|[[:space:]])' "$log_file" || true)"
|
||||
fi
|
||||
echo "${count:-0}"
|
||||
}
|
||||
|
||||
run_one() {
|
||||
local size="$1"
|
||||
local log_file="$OUT_DIR/${TOOL}_${size}.log"
|
||||
@@ -279,29 +300,34 @@ run_one() {
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$TOOL" == "warp" ]]; then
|
||||
local metrics throughput reqps latency error_count
|
||||
if [[ "$DRY_RUN" != "true" ]]; then
|
||||
metrics="$(collect_metrics "$log_file")"
|
||||
throughput="$(echo "$metrics" | cut -d',' -f1)"
|
||||
reqps="$(echo "$metrics" | cut -d',' -f2)"
|
||||
latency="$(echo "$metrics" | cut -d',' -f3)"
|
||||
error_count="$(collect_error_count "$log_file")"
|
||||
# Warp may still exit with code 0 even when it prints runtime failures.
|
||||
# Treat explicit error lines as failed runs to keep summary.csv reliable.
|
||||
if rg -q 'warp: <ERROR>' "$log_file"; then
|
||||
if [[ "$TOOL" == "warp" && "$error_count" != "0" ]]; then
|
||||
status="failed"
|
||||
fi
|
||||
else
|
||||
throughput="N/A"
|
||||
reqps="N/A"
|
||||
latency="N/A"
|
||||
error_count="N/A"
|
||||
fi
|
||||
|
||||
local metrics throughput reqps latency
|
||||
metrics="$(collect_metrics "$log_file")"
|
||||
throughput="$(echo "$metrics" | cut -d',' -f1)"
|
||||
reqps="$(echo "$metrics" | cut -d',' -f2)"
|
||||
latency="$(echo "$metrics" | cut -d',' -f3)"
|
||||
|
||||
echo "$size,$TOOL,$CONCURRENCY,$status,$throughput,$reqps,$latency,$log_file" >> "$SUMMARY_CSV"
|
||||
echo "$size,$TOOL,$CONCURRENCY,$status,$throughput,$reqps,$latency,$error_count,$log_file" >> "$SUMMARY_CSV"
|
||||
}
|
||||
|
||||
main() {
|
||||
parse_args "$@"
|
||||
validate_args
|
||||
resolve_bucket
|
||||
require_cmd rg
|
||||
if [[ "$DRY_RUN" != "true" ]]; then
|
||||
require_cmd rg
|
||||
require_cmd awk
|
||||
if [[ "$TOOL" == "warp" ]]; then
|
||||
require_cmd "$WARP_BIN"
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user