forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremote-client.sh
executable file
·137 lines (115 loc) · 2.87 KB
/
remote-client.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/usr/bin/env bash
set -e
cd "$(dirname "$0")"/../..
deployMethod="$1"
entrypointIp="$2"
clientToRun="$3"
if [[ -n $4 ]]; then
export RUST_LOG="$4"
fi
benchTpsExtraArgs="$5"
clientIndex="$6"
clientType="${7:-tpu-client}"
maybeUseUnstakedConnection="$8"
missing() {
echo "Error: $1 not specified"
exit 1
}
[[ -n $deployMethod ]] || missing deployMethod
[[ -n $entrypointIp ]] || missing entrypointIp
source net/common.sh
loadConfigFile
threadCount=$(nproc)
if [[ $threadCount -gt 4 ]]; then
threadCount=4
fi
case $deployMethod in
local|tar)
PATH="$HOME"/.cargo/bin:"$PATH"
export USE_INSTALL=1
net/scripts/rsync-retry.sh -vPrc "$entrypointIp:~/.cargo/bin/*" ~/.cargo/bin/
;;
skip)
;;
*)
echo "Unknown deployment method: $deployMethod"
exit 1
esac
RPC_CLIENT=false
case "$clientType" in
tpu-client)
RPC_CLIENT=false
;;
rpc-client)
RPC_CLIENT=true
;;
*)
echo "Unexpected clientType: \"$clientType\""
exit 1
;;
esac
case $clientToRun in
solana-bench-tps)
net/scripts/rsync-retry.sh -vPrc \
"$entrypointIp":~/solana/config/bench-tps"$clientIndex".yml ./client-accounts.yml
net/scripts/rsync-retry.sh -vPrc \
"$entrypointIp":~/solana/config/validator-identity-1.json ./validator-identity.json
args=()
if ${RPC_CLIENT}; then
args+=(--use-rpc-client)
fi
if [[ -z "$maybeUseUnstakedConnection" ]]; then
args+=(--bind-address "$entrypointIp")
args+=(--client-node-id ./validator-identity.json)
fi
clientCommand="\
solana-bench-tps \
--duration 7500 \
--sustained \
--threads $threadCount \
$benchTpsExtraArgs \
--read-client-keys ./client-accounts.yml \
--url "http://$entrypointIp:8899" \
${args[*]} \
"
;;
idle)
# Add the faucet keypair to idle clients for convenience
net/scripts/rsync-retry.sh -vPrc \
"$entrypointIp":~/solana/config/faucet.json ~/solana/
exit 0
;;
*)
echo "Unknown client name: $clientToRun"
exit 1
esac
cat > ~/solana/on-reboot <<EOF
#!/usr/bin/env bash
cd ~/solana
PATH="$HOME"/.cargo/bin:"$PATH"
export USE_INSTALL=1
echo "$(date) | $0 $*" >> client.log
(
sudo SOLANA_METRICS_CONFIG="$SOLANA_METRICS_CONFIG" scripts/oom-monitor.sh
) > oom-monitor.log 2>&1 &
echo \$! > oom-monitor.pid
scripts/fd-monitor.sh > fd-monitor.log 2>&1 &
echo \$! > fd-monitor.pid
scripts/net-stats.sh > net-stats.log 2>&1 &
echo \$! > net-stats.pid
! tmux list-sessions || tmux kill-session
tmux new -s "$clientToRun" -d "
while true; do
echo === Client start: \$(date) | tee -a client.log
$metricsWriteDatapoint 'testnet-deploy client-begin=1'
echo '$ $clientCommand' | tee -a client.log
$clientCommand >> client.log 2>&1
$metricsWriteDatapoint 'testnet-deploy client-complete=1'
done
"
EOF
chmod +x ~/solana/on-reboot
echo "@reboot ~/solana/on-reboot" | crontab -
~/solana/on-reboot
sleep 1
tmux capture-pane -t "$clientToRun" -p -S -100