Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 43 additions & 55 deletions accounts-cluster-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ pub fn poll_slot_height(client: &RpcClient) -> Slot {
return slot;
} else {
num_retries -= 1;
warn!(
"get_slot_height failure: {:?}. remaining retries {}",
response, num_retries
);
warn!("get_slot_height failure: {response:?}. remaining retries {num_retries}");
}
if num_retries == 0 {
panic!("failed to get_slot_height(), rpc node down?")
Expand All @@ -81,10 +78,7 @@ pub fn poll_get_latest_blockhash(client: &RpcClient) -> Option<Hash> {
return Some(blockhash);
} else {
num_retries -= 1;
warn!(
"get_latest_blockhash failure: {:?}. remaining retries {}",
response, num_retries
);
warn!("get_latest_blockhash failure: {response:?}. remaining retries {num_retries}");
}
if num_retries == 0 {
panic!("failed to get_latest_blockhash(), rpc node down?")
Expand All @@ -102,10 +96,7 @@ pub fn poll_get_fee_for_message(client: &RpcClient, message: &mut Message) -> (O
return (Some(fee), message.recent_blockhash);
} else {
num_retries -= 1;
warn!(
"get_fee_for_message failure: {:?}. remaining retries {}",
response, num_retries
);
warn!("get_fee_for_message failure: {response:?}. remaining retries {num_retries}");

let blockhash = poll_get_latest_blockhash(client).expect("blockhash");
message.recent_blockhash = blockhash;
Expand All @@ -119,7 +110,7 @@ pub fn poll_get_fee_for_message(client: &RpcClient, message: &mut Message) -> (O

fn airdrop_lamports(client: &RpcClient, id: &Keypair, desired_balance: u64) -> bool {
let starting_balance = client.get_balance(&id.pubkey()).unwrap_or(0);
info!("starting balance {}", starting_balance);
info!("starting balance {starting_balance}");

if starting_balance < desired_balance {
let airdrop_amount = desired_balance - starting_balance;
Expand All @@ -143,7 +134,7 @@ fn airdrop_lamports(client: &RpcClient, id: &Keypair, desired_balance: u64) -> b
let current_balance = client.get_balance(&id.pubkey()).unwrap_or_else(|e| {
panic!("airdrop error {e}");
});
info!("current balance {}...", current_balance);
info!("current balance {current_balance}...");

if current_balance - starting_balance != airdrop_amount {
info!(
Expand Down Expand Up @@ -396,10 +387,10 @@ fn process_get_multiple_accounts(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("error: {:?}", e);
info!("error: {e:?}");
*last_error = Instant::now();
}
debug!("error: {:?}", e);
debug!("error: {e:?}");
}
}
}
Expand Down Expand Up @@ -519,7 +510,7 @@ fn run_rpc_bench_loop(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("get_account_info error: {:?}", e);
info!("get_account_info error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -545,7 +536,7 @@ fn run_rpc_bench_loop(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("get_block error: {:?}", e);
info!("get_block error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -569,7 +560,7 @@ fn run_rpc_bench_loop(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("get_blocks error: {:?}", e);
info!("get_blocks error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -588,7 +579,7 @@ fn run_rpc_bench_loop(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("get_first_available_block error: {:?}", e);
info!("get_first_available_block error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -607,7 +598,7 @@ fn run_rpc_bench_loop(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("get_slot error: {:?}", e);
info!("get_slot error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -626,7 +617,7 @@ fn run_rpc_bench_loop(
stats.total_errors_time_us += rpc_time.as_us();
stats.errors += 1;
if last_error.elapsed().as_secs() > 2 {
info!("get_token_supply error: {:?}", e);
info!("get_token_supply error: {e:?}");
last_error = Instant::now();
}
}
Expand Down Expand Up @@ -659,7 +650,7 @@ fn run_rpc_bench_loop(
stats.errors += 1;
stats.total_errors_time_us += rpc_time.as_us();
if last_error.elapsed().as_secs() > 2 {
info!("get-program-accounts error: {:?}", e);
info!("get-program-accounts error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -679,7 +670,7 @@ fn run_rpc_bench_loop(
stats.errors += 1;
stats.total_errors_time_us += rpc_time.as_us();
if last_error.elapsed().as_secs() > 2 {
info!("get-token-accounts-by-delegate error: {:?}", e);
info!("get-token-accounts-by-delegate error: {e:?}");
last_error = Instant::now();
}
}
Expand All @@ -699,7 +690,7 @@ fn run_rpc_bench_loop(
stats.errors += 1;
stats.total_errors_time_us += rpc_time.as_us();
if last_error.elapsed().as_secs() > 2 {
info!("get-token-accounts-by-owner error: {:?}", e);
info!("get-token-accounts-by-owner error: {e:?}");
last_error = Instant::now();
}
}
Expand Down Expand Up @@ -781,7 +772,7 @@ fn make_rpc_bench_threads(
let transaction_signature_tracker = transaction_signature_tracker.clone();
let mint = *mint;
Builder::new()
.name(format!("rpc-bench-{}", thread))
.name(format!("rpc-bench-{thread}"))
.spawn(move || {
start_bench.wait();
run_rpc_bench_loop(
Expand Down Expand Up @@ -853,7 +844,7 @@ fn run_accounts_bench(
let transaction_signature_tracker =
TransactionSignatureTracker(Arc::new(RwLock::new(VecDeque::with_capacity(5000))));

info!("Starting balance(s): {:?}", balances);
info!("Starting balance(s): {balances:?}");

let executor = TransactionExecutor::new_with_rpc_client(client.clone());

Expand Down Expand Up @@ -917,10 +908,7 @@ fn run_accounts_bench(
}
last_balance = Instant::now();
if *balance < lamports * 2 {
info!(
"Balance {} is less than needed: {}, doing airdrop...",
balance, lamports
);
info!("Balance {balance} is less than needed: {lamports}, doing airdrop...");
if !airdrop_lamports(&client, payer_keypairs[i], lamports * 100_000) {
warn!("failed airdrop, exiting");
return;
Expand All @@ -934,7 +922,7 @@ fn run_accounts_bench(
if sigs_len < batch_size {
let num_to_create = batch_size - sigs_len;
if num_to_create >= payer_keypairs.len() {
info!("creating {} new", num_to_create);
info!("creating {num_to_create} new");
let chunk_size = num_to_create / payer_keypairs.len();
if chunk_size > 0 {
for (i, keypair) in payer_keypairs.iter().enumerate() {
Expand Down Expand Up @@ -1018,8 +1006,9 @@ fn run_accounts_bench(
|| max_accounts_met
{
info!(
"total_accounts_created: {} total_accounts_closed: {} tx_sent_count: {} loop_count: {} balance(s): {:?}",
total_accounts_created, total_accounts_closed, tx_sent_count, count, balances
"total_accounts_created: {total_accounts_created} total_accounts_closed: \
{total_accounts_closed} tx_sent_count: {tx_sent_count} loop_count: {count} \
balance(s): {balances:?}"
);
last_log = Instant::now();
}
Expand Down Expand Up @@ -1061,9 +1050,9 @@ fn run_accounts_bench(
(max_created_seed - max_closed_seed) as usize,
);
if num_to_close >= payer_keypairs.len() {
info!("closing {} accounts", num_to_close);
info!("closing {num_to_close} accounts");
let chunk_size = num_to_close / payer_keypairs.len();
info!("{:?} chunk_size", chunk_size);
info!("{chunk_size:?} chunk_size");
if chunk_size > 0 {
for (i, keypair) in payer_keypairs.iter().enumerate() {
let txs: Vec<_> = (0..chunk_size)
Expand Down Expand Up @@ -1101,8 +1090,8 @@ fn run_accounts_bench(
count += 1;
if last_log.elapsed().as_millis() > 3000 || max_closed_seed >= max_created_seed {
info!(
"total_accounts_closed: {} tx_sent_count: {} loop_count: {} balance(s): {:?}",
total_accounts_closed, tx_sent_count, count, balances
"total_accounts_closed: {total_accounts_closed} tx_sent_count: \
{tx_sent_count} loop_count: {count} balance(s): {balances:?}"
);
last_log = Instant::now();
}
Expand Down Expand Up @@ -1150,8 +1139,8 @@ fn main() {
.validator(is_url_or_moniker)
.conflicts_with("entrypoint")
.help(
"URL for Solana's JSON RPC or moniker (or their first letter): \
[mainnet-beta, testnet, devnet, localhost]",
"URL for Solana's JSON RPC or moniker (or their first letter): [mainnet-beta, \
testnet, devnet, localhost]",
),
)
.arg(
Expand Down Expand Up @@ -1206,10 +1195,9 @@ fn main() {
.takes_value(true)
.value_name("BYTES")
.help(
"Every `n` batches, create a batch of close transactions for \
the earliest remaining batch of accounts created. \
Note: Should be > 1 to avoid situations where the close \
transactions will be submitted before the corresponding \
"Every `n` batches, create a batch of close transactions for the earliest \
remaining batch of accounts created. Note: Should be > 1 to avoid situations \
where the close transactions will be submitted before the corresponding \
create transactions have been confirmed",
),
)
Expand All @@ -1232,7 +1220,10 @@ fn main() {
.long("max-accounts")
.takes_value(true)
.value_name("NUM_ACCOUNTS")
.help("Halt after client has created this number of accounts. Does not count closed accounts."),
.help(
"Halt after client has created this number of accounts. Does not count closed \
accounts.",
),
)
.arg(
Arg::with_name("check_gossip")
Expand Down Expand Up @@ -1273,10 +1264,7 @@ fn main() {
.takes_value(true)
.value_name("RPC_BENCH_TYPE(S)")
.multiple(true)
.requires_ifs(&[
("supply", "mint"),
("token-accounts-by-owner", "mint"),
])
.requires_ifs(&[("supply", "mint"), ("token-accounts-by-owner", "mint")])
.help("Spawn a thread which calls a specific RPC method in a loop to benchmark it"),
)
.get_matches();
Expand Down Expand Up @@ -1333,7 +1321,7 @@ fn main() {
Some(
solana_net_utils::get_cluster_shred_version(&entrypoint_addr).unwrap_or_else(
|err| {
eprintln!("Failed to get shred version: {}", err);
eprintln!("Failed to get shred version: {err}");
exit(1);
},
),
Expand All @@ -1344,7 +1332,7 @@ fn main() {
};

let rpc_addr = if !skip_gossip {
info!("Finding cluster entry: {:?}", entrypoint_addr);
info!("Finding cluster entry: {entrypoint_addr:?}");
let (gossip_nodes, _validators) = discover(
None, // keypair
Some(&entrypoint_addr),
Expand All @@ -1364,7 +1352,7 @@ fn main() {
info!("done found {} nodes", gossip_nodes.len());
gossip_nodes[0].rpc().unwrap()
} else {
info!("Using {:?} as the RPC address", entrypoint_addr);
info!("Using {entrypoint_addr:?} as the RPC address");
entrypoint_addr
};

Expand Down Expand Up @@ -1498,7 +1486,7 @@ pub mod test {
);
let post_txs = client.get_transaction_count().unwrap();
start.stop();
info!("{} pre {} post {}", start, pre_txs, post_txs);
info!("{start} pre {pre_txs} post {post_txs}");
}

#[test]
Expand Down Expand Up @@ -1548,7 +1536,7 @@ pub mod test {
);
let post_txs = client.get_transaction_count().unwrap();
start.stop();
info!("{} pre {} post {}", start, pre_txs, post_txs);
info!("{start} pre {pre_txs} post {post_txs}");
}

#[test]
Expand Down Expand Up @@ -1643,6 +1631,6 @@ pub mod test {
0,
);
start.stop();
info!("{}", start);
info!("{start}");
}
}
21 changes: 13 additions & 8 deletions banking-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,7 @@ fn main() {
.iter()
.map(|packets_for_single_iteration| packets_for_single_iteration.transactions.len() as u64)
.sum();
info!(
"worker threads: {} txs: {}",
block_production_num_workers, total_num_transactions
);
info!("worker threads: {block_production_num_workers} txs: {total_num_transactions}");

// fund all the accounts
all_packets.iter().for_each(|packets_for_single_iteration| {
Expand Down Expand Up @@ -483,7 +480,7 @@ fn main() {
let collector = solana_pubkey::new_rand();
let mut total_sent = 0;
for current_iteration_index in 0..iterations {
trace!("RUNNING ITERATION {}", current_iteration_index);
trace!("RUNNING ITERATION {current_iteration_index}");
let now = Instant::now();
let mut sent = 0;

Expand Down Expand Up @@ -592,10 +589,18 @@ fn main() {
.unwrap()
.working_bank()
.transaction_count();
debug!("processed: {} base: {}", txs_processed, base_tx_count);
debug!("processed: {txs_processed} base: {base_tx_count}");

eprintln!("[total_sent: {}, base_tx_count: {}, txs_processed: {}, txs_landed: {}, total_us: {}, tx_total_us: {}]",
total_sent, base_tx_count, txs_processed, (txs_processed - base_tx_count), total_us, tx_total_us);
eprintln!(
"[total_sent: {}, base_tx_count: {}, txs_processed: {}, txs_landed: {}, total_us: {}, \
tx_total_us: {}]",
total_sent,
base_tx_count,
txs_processed,
(txs_processed - base_tx_count),
total_us,
tx_total_us
);

eprintln!(
"{{'name': 'banking_bench_total', 'median': '{:.2}'}}",
Expand Down
6 changes: 3 additions & 3 deletions core/src/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,9 @@ impl BankingStage {
}

info!(
"Spawning new banking stage non-vote threads with block-production-method: {:?} \
transaction-structure: {:?} num-workers: {}",
block_production_method, transaction_struct, num_workers
"Spawning new banking stage non-vote threads with block-production-method: \
{block_production_method:?} transaction-structure: {transaction_struct:?} \
num-workers: {num_workers}"
);
context.non_vote_exit_signal.store(false, Ordering::Relaxed);
Self::new_central_scheduler(
Expand Down
Loading
Loading