Files
consensus/scripts/distributed-benchmark.sh
T
2025-08-01 14:00:50 -05:00

35 lines
947 B
Bash
Executable File

#!/bin/bash
# Distributed multi-machine benchmark setup
set -e
# Configuration
MODE=${1:-coordinator} # coordinator or worker
COORDINATOR_IP=${2:-localhost}
COORDINATOR_PORT=${3:-5555}
NODES=${4:-100}
ROUNDS=${5:-1000}
if [ "$MODE" = "coordinator" ]; then
echo "🎯 Starting as COORDINATOR"
echo " Bind address: tcp://*:$COORDINATOR_PORT"
echo " Total nodes: $NODES"
echo " Rounds: $ROUNDS"
echo ""
echo "Workers should connect to: tcp://$(hostname -I | awk '{print $1}'):$COORDINATOR_PORT"
echo ""
./bin/consensus benchmark \
--transport zmq \
--zmq-bind "tcp://*:$COORDINATOR_PORT" \
--nodes $NODES \
--rounds $ROUNDS
else
echo "🔗 Starting as WORKER"
echo " Connecting to: tcp://$COORDINATOR_IP:$COORDINATOR_PORT"
echo ""
./bin/consensus benchmark \
--transport zmq \
--zmq-bind "tcp://$COORDINATOR_IP:$COORDINATOR_PORT"
fi