solana/net/remote/remote-client.sh

76 lines
1.8 KiB
Bash
Raw Normal View History

2018-09-07 08:46:20 -07:00
#!/bin/bash -e
2018-09-04 09:21:03 -07:00
cd "$(dirname "$0")"/../..
2018-09-03 21:15:55 -07:00
deployMethod="$1"
entrypointIp="$2"
2018-09-03 21:15:55 -07:00
numNodes="$3"
RUST_LOG="$4"
2018-09-07 08:46:20 -07:00
missing() {
echo "Error: $1 not specified"
exit 1
}
[[ -n $deployMethod ]] || missing deployMethod
[[ -n $entrypointIp ]] || missing entrypointIp
[[ -n $numNodes ]] || missing numNodes
source net/common.sh
loadConfigFile
2018-09-03 21:15:55 -07:00
threadCount=$(nproc)
if [[ $threadCount -gt 4 ]]; then
threadCount=4
fi
2018-09-04 09:21:03 -07:00
scripts/install-earlyoom.sh
2018-09-03 21:15:55 -07:00
case $deployMethod in
snap)
rsync -vPrc "$entrypointIp:~/solana/solana.snap" .
2018-09-03 21:15:55 -07:00
sudo snap install solana.snap --devmode --dangerous
rm solana.snap
2018-09-04 14:46:28 -07:00
nodeConfig="\
leader-ip=$entrypointIp \
2018-09-04 15:16:25 -07:00
default-metrics-rate=1 \
2018-09-04 14:46:28 -07:00
metrics-config=$SOLANA_METRICS_CONFIG \
rust-log=$RUST_LOG \
"
# shellcheck disable=SC2086 # Don't want to double quote "$nodeConfig"
sudo snap set solana $nodeConfig
2018-09-03 21:15:55 -07:00
solana_bench_tps=/snap/bin/solana.bench-tps
;;
local)
PATH="$HOME"/.cargo/bin:"$PATH"
export USE_INSTALL=1
2018-09-04 15:16:25 -07:00
export SOLANA_DEFAULT_METRICS_RATE=1
2018-09-03 21:15:55 -07:00
export RUST_LOG
rsync -vPrc "$entrypointIp:~/.cargo/bin/solana*" ~/.cargo/bin/
2018-09-05 07:56:26 -07:00
solana_bench_tps="multinode-demo/client.sh $entrypointIp:~/solana $entrypointIp:8001"
2018-09-03 21:15:55 -07:00
;;
*)
echo "Unknown deployment method: $deployMethod"
exit 1
esac
2018-09-04 15:16:25 -07:00
scripts/oom-monitor.sh > oom-monitor.log 2>&1 &
2018-08-29 07:48:38 -07:00
2018-09-07 08:34:42 -07:00
! tmux list-sessions || tmux kill-session
2018-09-03 21:15:55 -07:00
2018-09-07 08:34:42 -07:00
clientCommand="$solana_bench_tps --num-nodes $numNodes --seconds 600 --sustained --threads $threadCount"
tmux new -s solana-bench-tps -d "
while true; do
echo === Client start: \$(date) >> client.log
$metricsWriteDatapoint 'testnet-deploy client-begin=1'
echo '$ $clientCommand' >> client.log
$clientCommand >> client.log 2>&1
$metricsWriteDatapoint 'testnet-deploy client-complete=1'
done
"
sleep 1
tmux capture-pane -t solana-bench-tps -p -S -100