client changes for TODOs and looping (#1138)
* remove client.sh from snap * default to ephemeral instead of ~/.config key * rework CLI for bench-tps * remote multinode-demo stuff from remote-client.sh * remove multinode-demo from remote-sanity and localnet-sanity
This commit is contained in:
parent
5169c8d08f
commit
51b27779c9
@ -70,7 +70,11 @@ echo "--- Wallet sanity"
|
||||
echo "--- Node count"
|
||||
(
|
||||
set -x
|
||||
./multinode-demo/client.sh --num-nodes 3 --converge-only
|
||||
source multinode-demo/common.sh
|
||||
client_id=/tmp/client-id.json-$$
|
||||
$solana_keygen -o $client_id
|
||||
$solana_bench_tps --identity $client_id --num-nodes 3 --converge-only
|
||||
rm -rf $client_id
|
||||
) || flag_error
|
||||
|
||||
killBackgroundCommands
|
||||
|
@ -9,33 +9,13 @@ usage() {
|
||||
echo "$*"
|
||||
echo
|
||||
fi
|
||||
echo "usage: $0 [network entry point] [extra args]"
|
||||
echo "usage: $0 [extra args]"
|
||||
echo
|
||||
echo " Run bench-tps against the specified network"
|
||||
echo " Run bench-tps "
|
||||
echo
|
||||
echo " extra args: additional arguments are pass along to solana-bench-tps"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# This is a little hacky
|
||||
if [[ ${1:0:2} != "--" ]]; then
|
||||
if [[ ${2:0:2} != "--" ]]; then
|
||||
read -r _ leader_address shift < <(find_leader "${@:1:2}")
|
||||
else
|
||||
read -r _ leader_address shift < <(find_leader "${@:1:1}")
|
||||
fi
|
||||
else
|
||||
read -r _ leader_address shift < <(find_leader)
|
||||
fi
|
||||
shift "$shift"
|
||||
|
||||
|
||||
client_json="$SOLANA_CONFIG_CLIENT_DIR"/client.json
|
||||
[[ -r $client_json ]] || $solana_keygen -o "$client_json"
|
||||
|
||||
set -x
|
||||
$solana_bench_tps \
|
||||
--network "$leader_address" \
|
||||
--keypair "$SOLANA_CONFIG_CLIENT_DIR"/client.json \
|
||||
"$@"
|
||||
$solana_bench_tps "$@"
|
||||
|
@ -32,16 +32,8 @@ snap)
|
||||
sudo snap install solana.snap --devmode --dangerous
|
||||
rm solana.snap
|
||||
|
||||
nodeConfig="\
|
||||
leader-ip=$entrypointIp \
|
||||
default-metrics-rate=1 \
|
||||
metrics-config=$SOLANA_METRICS_CONFIG \
|
||||
rust-log=$RUST_LOG \
|
||||
"
|
||||
# shellcheck disable=SC2086 # Don't want to double quote "$nodeConfig"
|
||||
sudo snap set solana $nodeConfig
|
||||
|
||||
solana_bench_tps=/snap/bin/solana.bench-tps
|
||||
solana_keygen=/snap/bin/solana.keygen
|
||||
;;
|
||||
local)
|
||||
PATH="$HOME"/.cargo/bin:"$PATH"
|
||||
@ -50,7 +42,8 @@ local)
|
||||
export RUST_LOG
|
||||
|
||||
rsync -vPrc "$entrypointIp:~/.cargo/bin/solana*" ~/.cargo/bin/
|
||||
solana_bench_tps="multinode-demo/client.sh $entrypointIp:~/solana $entrypointIp:8001"
|
||||
solana_bench_tps=solana-bench-tps
|
||||
solana_keygen=solana-keygen
|
||||
;;
|
||||
*)
|
||||
echo "Unknown deployment method: $deployMethod"
|
||||
@ -62,7 +55,13 @@ scripts/oom-monitor.sh > oom-monitor.log 2>&1 &
|
||||
! tmux list-sessions || tmux kill-session
|
||||
|
||||
clientCommand="$solana_bench_tps --num-nodes $numNodes --seconds 600 --sustained --threads $threadCount"
|
||||
keygenCommand="$solana_keygen -o client.id"
|
||||
tmux new -s solana-bench-tps -d "
|
||||
[[ -r client.json ]] || {
|
||||
echo '$ $keygenCommand' >> client.log
|
||||
$keygenCommand >> client.log 2>&1
|
||||
}
|
||||
|
||||
while true; do
|
||||
echo === Client start: \$(date) >> client.log
|
||||
$metricsWriteDatapoint 'testnet-deploy client-begin=1'
|
||||
|
@ -51,22 +51,27 @@ case $deployMethod in
|
||||
snap)
|
||||
PATH="/snap/bin:$PATH"
|
||||
export USE_SNAP=1
|
||||
entrypointRsyncUrl="$entrypointIp"
|
||||
|
||||
solana_bench_tps=solana.bench-tps
|
||||
solana_ledger_tool=solana.ledger-tool
|
||||
ledger=/var/snap/solana/current/config/ledger
|
||||
solana_keygen=solana.keygen
|
||||
|
||||
ledger=/var/snap/solana/current/config/ledger
|
||||
client_id=/var/snap/solana/current/config/client-id.json
|
||||
|
||||
entrypointRsyncUrl="$entrypointIp"
|
||||
;;
|
||||
local)
|
||||
PATH="$HOME"/.cargo/bin:"$PATH"
|
||||
export USE_INSTALL=1
|
||||
|
||||
entrypointRsyncUrl="$entrypointIp:~/solana"
|
||||
|
||||
solana_bench_tps="multinode-demo/client.sh $entrypointRsyncUrl $entrypointIp:8001"
|
||||
solana_bench_tps=solana-bench-tps
|
||||
solana_ledger_tool=solana-ledger-tool
|
||||
solana_keygen=solana-keygen
|
||||
|
||||
ledger=config/ledger
|
||||
client_id=config/client-id.json
|
||||
;;
|
||||
*)
|
||||
echo "Unknown deployment method: $deployMethod"
|
||||
@ -83,7 +88,8 @@ echo "--- $entrypointIp: wallet sanity"
|
||||
echo "--- $entrypointIp: node count"
|
||||
(
|
||||
set -x
|
||||
$solana_bench_tps --num-nodes "$numNodes" --converge-only
|
||||
[[ -r $client_id ]] || $solana_keygen -o "$client_id"
|
||||
$solana_bench_tps --network "$entrypointIp:8001" --identity "$client_id" --num-nodes "$numNodes" --converge-only
|
||||
)
|
||||
|
||||
echo "--- $entrypointIp: verify ledger"
|
||||
@ -128,4 +134,3 @@ else
|
||||
echo "^^^ +++"
|
||||
echo "Validator sanity disabled (NO_VALIDATOR_SANITY defined)"
|
||||
fi
|
||||
|
||||
|
@ -49,9 +49,7 @@ apps:
|
||||
plugs:
|
||||
- home
|
||||
bench-tps:
|
||||
# TODO: Merge client.sh functionality into solana-bench-tps proper
|
||||
command: multinode-demo/client.sh
|
||||
#command: solana-bench-tps
|
||||
command: solana-bench-tps
|
||||
plugs:
|
||||
- network
|
||||
- network-bind
|
||||
|
@ -4,6 +4,7 @@ extern crate clap;
|
||||
extern crate influx_db_client;
|
||||
extern crate rayon;
|
||||
extern crate serde_json;
|
||||
#[macro_use]
|
||||
extern crate solana;
|
||||
|
||||
use clap::{App, Arg};
|
||||
@ -401,11 +402,6 @@ fn should_switch_directions(num_tokens_per_account: i64, i: i64) -> bool {
|
||||
fn main() {
|
||||
logger::setup();
|
||||
metrics::set_panic_hook("bench-tps");
|
||||
let mut threads = 4usize;
|
||||
let mut num_nodes = 1usize;
|
||||
let mut time_sec = 90;
|
||||
let mut sustained = false;
|
||||
let mut tx_count = 500_000;
|
||||
|
||||
let matches = App::new("solana-bench-tps")
|
||||
.version(crate_version!())
|
||||
@ -415,17 +411,16 @@ fn main() {
|
||||
.long("network")
|
||||
.value_name("HOST:PORT")
|
||||
.takes_value(true)
|
||||
.required(true)
|
||||
.help("rendezvous with the network at this gossip entry point"),
|
||||
.help("rendezvous with the network at this gossip entry point, defaults to 127.0.0.1:8001"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("keypair")
|
||||
.short("k")
|
||||
.long("keypair")
|
||||
Arg::with_name("identity")
|
||||
.short("i")
|
||||
.long("identity")
|
||||
.value_name("PATH")
|
||||
.takes_value(true)
|
||||
.default_value("~/.config/solana/id.json")
|
||||
.help("/path/to/id.json"),
|
||||
.required(true)
|
||||
.help("file containing a client identity (keypair)"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("num-nodes")
|
||||
@ -444,63 +439,68 @@ fn main() {
|
||||
.help("number of threads"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("seconds")
|
||||
.short("s")
|
||||
.long("seconds")
|
||||
.value_name("NUM")
|
||||
Arg::with_name("duration")
|
||||
.long("duration")
|
||||
.value_name("SECS")
|
||||
.takes_value(true)
|
||||
.help("send transactions for this many seconds"),
|
||||
.help("run benchmark for SECS seconds then exit, default is forever"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("converge-only")
|
||||
.short("c")
|
||||
.long("converge-only")
|
||||
.help("exit immediately after converging"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("sustained")
|
||||
.long("sustained")
|
||||
.help("Use sustained performance mode vs. peak mode. This overlaps the tx generation with transfers."),
|
||||
.help("use sustained performance mode vs. peak mode. This overlaps the tx generation with transfers."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("tx_count")
|
||||
.long("tx_count")
|
||||
.value_name("NUMBER")
|
||||
.value_name("NUM")
|
||||
.takes_value(true)
|
||||
.help("number of transactions to send in a single batch")
|
||||
.help("number of transactions to send per batch")
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
let network = matches
|
||||
.value_of("network")
|
||||
.unwrap()
|
||||
.parse()
|
||||
.unwrap_or_else(|e| {
|
||||
let network = if let Some(addr) = matches.value_of("network") {
|
||||
addr.parse().unwrap_or_else(|e| {
|
||||
eprintln!("failed to parse network: {}", e);
|
||||
exit(1)
|
||||
});
|
||||
})
|
||||
} else {
|
||||
socketaddr!("127.0.0.1:8001")
|
||||
};
|
||||
|
||||
let id = read_keypair(matches.value_of("keypair").unwrap()).expect("client keypair");
|
||||
let id =
|
||||
read_keypair(matches.value_of("identity").unwrap()).expect("can't read client identity");
|
||||
|
||||
if let Some(t) = matches.value_of("threads") {
|
||||
threads = t.to_string().parse().expect("integer");
|
||||
}
|
||||
let threads = if let Some(t) = matches.value_of("threads") {
|
||||
t.to_string().parse().expect("can't parse threads")
|
||||
} else {
|
||||
4usize
|
||||
};
|
||||
|
||||
if let Some(n) = matches.value_of("num-nodes") {
|
||||
num_nodes = n.to_string().parse().expect("integer");
|
||||
}
|
||||
let num_nodes = if let Some(n) = matches.value_of("num-nodes") {
|
||||
n.to_string().parse().expect("can't parse num-nodes")
|
||||
} else {
|
||||
1usize
|
||||
};
|
||||
|
||||
if let Some(s) = matches.value_of("seconds") {
|
||||
time_sec = s.to_string().parse().expect("integer");
|
||||
}
|
||||
let duration = if let Some(s) = matches.value_of("duration") {
|
||||
Duration::new(s.to_string().parse().expect("can't parse duration"), 0)
|
||||
} else {
|
||||
Duration::new(std::u64::MAX, 0)
|
||||
};
|
||||
|
||||
if let Some(s) = matches.value_of("tx_count") {
|
||||
tx_count = s.to_string().parse().expect("integer");
|
||||
}
|
||||
let tx_count = if let Some(s) = matches.value_of("tx_count") {
|
||||
s.to_string().parse().expect("can't parse tx_count")
|
||||
} else {
|
||||
500_000
|
||||
};
|
||||
|
||||
if matches.is_present("sustained") {
|
||||
sustained = true;
|
||||
}
|
||||
let sustained = matches.is_present("sustained");
|
||||
|
||||
let leader = poll_gossip_for_leader(network, None).expect("unable to find leader on network");
|
||||
|
||||
@ -617,11 +617,12 @@ fn main() {
|
||||
.collect();
|
||||
|
||||
// generate and send transactions for the specified duration
|
||||
let time = Duration::new(time_sec, 0);
|
||||
let now = Instant::now();
|
||||
let mut last_stat = Instant::now();
|
||||
let stat_interval = Duration::new(90, 0);
|
||||
let mut reclaim_tokens_back_to_source_account = false;
|
||||
let mut i = keypair0_balance;
|
||||
while now.elapsed() < time {
|
||||
while now.elapsed() < duration {
|
||||
let balance = client.poll_get_balance(&id.pubkey()).unwrap_or(-1);
|
||||
metrics_submit_token_balance(balance);
|
||||
|
||||
@ -653,6 +654,16 @@ fn main() {
|
||||
if should_switch_directions(num_tokens_per_account, i) {
|
||||
reclaim_tokens_back_to_source_account = !reclaim_tokens_back_to_source_account;
|
||||
}
|
||||
|
||||
if last_stat.elapsed() >= stat_interval {
|
||||
last_stat = Instant::now();
|
||||
compute_and_report_stats(
|
||||
&maxes,
|
||||
sample_period,
|
||||
&now.elapsed(),
|
||||
total_tx_sent_count.load(Ordering::Relaxed),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Stop the sampling threads so it will collect the stats
|
||||
|
Loading…
x
Reference in New Issue
Block a user