From 19de07a98633fd21e9a6ca100a2a0f1bd3f15c7b Mon Sep 17 00:00:00 2001 From: Kirill Lykov Date: Wed, 24 Aug 2022 10:43:46 +0200 Subject: [PATCH] split accounts request into chunks --- bench-tps/src/bench.rs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/bench-tps/src/bench.rs b/bench-tps/src/bench.rs index b7d8ae54eb249d..22bc37b21d2953 100644 --- a/bench-tps/src/bench.rs +++ b/bench-tps/src/bench.rs @@ -8,7 +8,7 @@ use { log::*, rand::distributions::{Distribution, Uniform}, rayon::prelude::*, - solana_client::nonce_utils, + solana_client::{nonce_utils, rpc_request::MAX_MULTIPLE_ACCOUNTS}, solana_metrics::{self, datapoint_info}, solana_sdk::{ account::Account, @@ -559,7 +559,7 @@ fn get_nonce_accounts( } fn get_nonce_blockhashes( - client: Arc, + client: &Arc, nonce_pubkeys: &[Pubkey], ) -> Vec { let num_accounts = nonce_pubkeys.len(); @@ -580,7 +580,7 @@ fn get_nonce_blockhashes( let num_unprocessed_before = unprocessed.len(); info!("Request {} durable nonce accounts", num_unprocessed_before); - let accounts = get_nonce_accounts(&client, nonce_pubkeys); + let accounts = get_nonce_accounts(client, nonce_pubkeys); for (account, index) in accounts.iter().zip(request_indexes.iter()) { if let Some(nonce_account) = account { let nonce_data = nonce_utils::data_from_account(nonce_account).unwrap(); @@ -614,7 +614,12 @@ fn generate_nonced_system_txs = pubkeys + .chunks(MAX_MULTIPLE_ACCOUNTS) + .map(|pubkeys| get_nonce_blockhashes(&client, &pubkeys)) + .flatten() + .collect(); for i in 0..length { transactions.push(( @@ -631,7 +636,11 @@ fn generate_nonced_system_txs = dest_nonce.iter().map(|keypair| keypair.pubkey()).collect(); - let blockhashes = get_nonce_blockhashes(client, &pubkeys); + let blockhashes: Vec = pubkeys + .chunks(MAX_MULTIPLE_ACCOUNTS) + .map(|pubkeys| get_nonce_blockhashes(&client, &pubkeys)) + .flatten() + .collect(); for i in 0..length { transactions.push((