Add bench-exchange support to the net framework (#3893)

This commit is contained in:
Jack May 2019-04-19 09:56:01 -07:00 committed by GitHub
parent 809b051f10
commit 1a9ac62f60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 96 additions and 27 deletions

View File

@ -42,7 +42,7 @@ macro_rules! socketaddr {
}
pub const TIME_SLICE: u64 = 60;
pub const REQUEST_CAP: u64 = 500_000_000;
pub const REQUEST_CAP: u64 = 100_000_000_000_000;
pub const DRONE_PORT: u16 = 9900;
#[derive(Serialize, Deserialize, Debug, Clone, Copy)]

View File

@ -4,7 +4,7 @@ here=$(dirname "$0")
# shellcheck source=multinode-demo/common.sh
source "$here"/common.sh
lamports=1000000000
lamports=100000000000000
bootstrap_leader_lamports=
usage () {

View File

@ -20,7 +20,7 @@ $ aws configure
```
More information on AWS CLI configuration can be found [here](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-quick-configuration)
### Metrics configuration
### Metrics configuration (Optional)
Ensure that `$(whoami)` is the name of an InfluxDB user account with enough
access to create a new InfluxDB database. Ask mvines@ for help if needed.
@ -31,11 +31,11 @@ NOTE: This example uses GCE. If you are using AWS EC2, replace `./gce.sh` with
```bash
$ cd net/
$ ./gce.sh create -n 5 -c 1 #<-- Create a GCE testnet with 5 additional nodes (beyond the bootstrap node), 1 client bencher (billing starts here)
$ ./gce.sh create -n 5 -c 1 #<-- Create a GCE testnet with 5 additional nodes (beyond the bootstrap node) and 1 client (billing starts here)
$ ./init-metrics.sh $(whoami) #<-- Configure a metrics database for the testnet
$ ./net.sh start #<-- Deploy the network from the local workspace
$ ./ssh.sh #<-- Details on how to ssh into any testnet node to access logs/etc
$ ./gce.sh delete #<-- Dispose of the network (billing stops here)
$ ./net.sh start #<-- Deploy the network from the local workspace and start all clients with bench-tps
$ ./ssh.sh #<-- Details on how to ssh into any testnet node to access logs/etc
$ ./gce.sh delete #<-- Dispose of the network (billing stops here)
```
## Tips

View File

@ -37,6 +37,12 @@ Operate a configured testnet
-r - Reuse existing node/ledger configuration from a
previous |start| (ie, don't run ./multinode-demo/setup.sh).
-D /path/to/programs - Deploy custom programs from this location
-c clientType=numClients - Number of clientTypes to start. This options can be specified
more than once. Defaults to bench-tps for all clients if not
specified.
Valid client types are:
bench-tps
bench-exchange
sanity/start/update-specific options:
-o noLedgerVerify - Skip ledger verification
@ -64,12 +70,14 @@ updateNodes=false
customPrograms=
updateManifestKeypairFile=
updateDownloadUrl=
numBenchTpsClients=0
numBenchExchangeClients=0
command=$1
[[ -n $command ]] || usage
shift
while getopts "h?T:t:o:f:rD:i:" opt; do
while getopts "h?T:t:o:f:rD:i:c:" opt; do
case $opt in
h | \?)
usage
@ -117,6 +125,36 @@ while getopts "h?T:t:o:f:rD:i:" opt; do
;;
esac
;;
c)
getClientTypeAndNum() {
if ! [[ $OPTARG == *'='* ]]; then
echo "Error: Expecting keypair \"clientType=numClientType\" but got \"$OPTARG\""
exit 1
fi
local keyValue
IFS='=' read -ra keyValue <<< "$OPTARG"
local clientType=${keyValue[0]}
local numClients=${keyValue[1]}
re='^[0-9]+$'
if ! [[ $numClients =~ $re ]] ; then
echo "error: numClientType must be a number but got \"$numClients\""
exit 1
fi
case $clientType in
bench-tps)
numBenchTpsClients=$numClients
;;
bench-exchange)
numBenchExchangeClients=$numClients
;;
*)
echo "Unknown client type: $clientType"
exit 1
;;
esac
}
getClientTypeAndNum
;;
*)
usage "Error: unhandled option: $opt"
;;
@ -125,11 +163,22 @@ done
loadConfigFile
numClients=${#clientIpList[@]}
numClientsRequested=$((numBenchTpsClients+numBenchExchangeClients))
if [[ "$numClientsRequested" -eq 0 ]]; then
numBenchTpsClients=$numClients
else
if [[ "$numClientsRequested" -gt "$numClients" ]]; then
echo "Error: More clients requested ($numClientsRequested) then available ($numClients)"
exit 1
fi
fi
build() {
declare MAYBE_DOCKER=
if [[ $(uname) != Linux ]]; then
# shellcheck source=ci/rust-version.sh
source ../ci/rust-version.sh
# shellcheck source=ci/rust-version.sh
source "$SOLANA_ROOT"/ci/rust-version.sh
MAYBE_DOCKER="ci/docker-run.sh $rust_stable_docker_image"
fi
SECONDS=0
@ -251,14 +300,15 @@ startNode() {
startClient() {
declare ipAddress=$1
declare logFile="$2"
echo "--- Starting client: $ipAddress"
declare clientToRun="$2"
declare logFile="$netLogDir/client-$clientToRun-$ipAddress.log"
echo "--- Starting client: $ipAddress - $clientToRun"
echo "start log: $logFile"
(
set -x
startCommon "$ipAddress"
ssh "${sshOptions[@]}" -f "$ipAddress" \
"./solana/net/remote/remote-client.sh $deployMethod $entrypointIp \"$RUST_LOG\""
"./solana/net/remote/remote-client.sh $deployMethod $entrypointIp $clientToRun \"$RUST_LOG\""
) >> "$logFile" 2>&1 || {
cat "$logFile"
echo "^^^ +++"
@ -411,8 +461,12 @@ start() {
sanity
SECONDS=0
for ipAddress in "${clientIpList[@]}"; do
startClient "$ipAddress" "$netLogDir/client-$ipAddress.log"
for ((i=0; i < "$numClients" && i < "$numClientsRequested"; i++)) do
if [[ $i -lt "$numBenchTpsClients" ]]; then
startClient "${clientIpList[$i]}" "solana-bench-tps"
else
startClient "${clientIpList[$i]}" "solana-bench-exchange"
fi
done
clientDeployTime=$SECONDS

View File

@ -7,7 +7,8 @@ echo "$(date) | $0 $*" > client.log
deployMethod="$1"
entrypointIp="$2"
RUST_LOG="$3"
clientToRun="$3"
RUST_LOG="$4"
export RUST_LOG=${RUST_LOG:-solana=info} # if RUST_LOG is unset, default to info
missing() {
@ -36,7 +37,6 @@ local|tar)
source ./target/perf-libs/env.sh
net/scripts/rsync-retry.sh -vPrc "$entrypointIp:~/.cargo/bin/solana*" ~/.cargo/bin/
solana_bench_tps=solana-bench-tps
;;
*)
echo "Unknown deployment method: $deployMethod"
@ -50,16 +50,31 @@ scripts/net-stats.sh > net-stats.log 2>&1 &
! tmux list-sessions || tmux kill-session
clientCommand="\
$solana_bench_tps \
--network $entrypointIp:8001 \
--drone $entrypointIp:9900 \
--duration 7500 \
--sustained \
--threads $threadCount \
"
case $clientToRun in
solana-bench-tps)
clientCommand="\
solana-bench-tps \
--network $entrypointIp:8001 \
--drone $entrypointIp:9900 \
--duration 7500 \
--sustained \
--threads $threadCount \
"
;;
solana-bench-exchange)
clientCommand="\
solana-bench-exchange \
--network $entrypointIp:8001 \
--drone $entrypointIp:9900 \
--threads $threadCount \
"
;;
*)
echo "Unknown client name: $clientToRun"
exit 1
esac
tmux new -s solana-bench-tps -d "
tmux new -s "$clientToRun" -d "
while true; do
echo === Client start: \$(date) | tee -a client.log
$metricsWriteDatapoint 'testnet-deploy client-begin=1'
@ -69,4 +84,4 @@ tmux new -s solana-bench-tps -d "
done
"
sleep 1
tmux capture-pane -t solana-bench-tps -p -S -100
tmux capture-pane -t "$clientToRun" -p -S -100