solana/net/remote/remote-client.sh

82 lines
1.9 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
2018-09-04 09:21:03 -07:00
cd "$(dirname "$0")"/../..
echo "$(date) | $0 $*" > client.log
2018-09-03 21:15:55 -07:00
deployMethod="$1"
entrypointIp="$2"
RUST_LOG="$3"
2018-09-07 20:50:46 -07:00
export RUST_LOG=${RUST_LOG:-solana=info} # if RUST_LOG is unset, default to info
2018-09-07 08:46:20 -07:00
missing() {
echo "Error: $1 not specified"
exit 1
}
[[ -n $deployMethod ]] || missing deployMethod
[[ -n $entrypointIp ]] || missing entrypointIp
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-03 21:15:55 -07:00
case $deployMethod in
snap)
net/scripts/rsync-retry.sh -vPrc "$entrypointIp:~/solana/solana.snap" .
2018-09-03 21:15:55 -07:00
sudo snap install solana.snap --devmode --dangerous
solana_bench_tps=/snap/bin/solana.bench-tps
solana_keygen=/snap/bin/solana.keygen
2018-09-03 21:15:55 -07:00
;;
local|tar)
2018-09-03 21:15:55 -07:00
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
net/scripts/rsync-retry.sh -vPrc "$entrypointIp:~/.cargo/bin/solana*" ~/.cargo/bin/
solana_bench_tps=solana-bench-tps
solana_keygen=solana-keygen
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 &
scripts/net-stats.sh > net-stats.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 20:21:41 -07:00
clientCommand="\
$solana_bench_tps \
--network $entrypointIp:8001 \
--identity client.json \
--duration 7500 \
2018-09-07 20:21:41 -07:00
--sustained \
--threads $threadCount \
"
keygenCommand="$solana_keygen -o client.json"
2018-09-07 08:34:42 -07:00
tmux new -s solana-bench-tps -d "
[[ -r client.json ]] || {
2018-09-07 20:50:46 -07:00
echo '$ $keygenCommand' | tee -a client.log
$keygenCommand >> client.log 2>&1
}
2018-09-07 08:34:42 -07:00
while true; do
2018-09-07 20:50:46 -07:00
echo === Client start: \$(date) | tee -a client.log
2018-09-07 08:34:42 -07:00
$metricsWriteDatapoint 'testnet-deploy client-begin=1'
2018-09-07 20:50:46 -07:00
echo '$ $clientCommand' | tee -a client.log
2018-09-07 08:34:42 -07:00
$clientCommand >> client.log 2>&1
$metricsWriteDatapoint 'testnet-deploy client-complete=1'
done
"
sleep 1
tmux capture-pane -t solana-bench-tps -p -S -100