Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A benchmark suite for the getAccountInfo RPC call #3959

Merged
Merged
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
31 changes: 31 additions & 0 deletions accounts-cluster-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ pub enum RpcBench {
TokenAccountsByOwner,
Supply,
TokenAccountsByDelegate,
AccountInfo,
}

#[derive(Debug)]
Expand All @@ -268,6 +269,7 @@ impl FromStr for RpcBench {

fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"account-info" => Ok(RpcBench::AccountInfo),
"slot" => Ok(RpcBench::Slot),
"supply" => Ok(RpcBench::Supply),
"multiple-accounts" => Ok(RpcBench::MultipleAccounts),
Expand Down Expand Up @@ -390,6 +392,35 @@ fn run_rpc_bench_loop(
break;
}
match rpc_bench {
RpcBench::AccountInfo => {
let start: u64 = max_closed.load(Ordering::Relaxed);
let end: u64 = max_created.load(Ordering::Relaxed);
let seed_range = start..end;
if seed_range.is_empty() {
info!("get_account_info: No accounts have yet been created; skipping");
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See note here: #3960.

continue;
}
let seed = thread_rng().gen_range(seed_range).to_string();
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Samples randomly from the range of seeds belonging to open accounts.

let account_pubkey =
Pubkey::create_with_seed(base_keypair_pubkey, &seed, program_id).unwrap();
let mut rpc_time = Measure::start("rpc-get-account-info");
match client.get_account(&account_pubkey) {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some percentage of these loads fail with:

[2024-12-05T22:23:08.309451301Z INFO  solana_accounts_cluster_bench] get_account_info error: Error { request: None, kind: RpcError(ForUser("AccountNotFound: pubkey=Bp88sz54nzCwcxv8S7K6s6Yw5MX4H2FVwVm5sufvBDPa")) }

I don't know if executor.pushTransactions() is sufficient to presume that the accounts have actually been created.

https://github.com/anza-xyz/agave/blob/master/accounts-cluster-bench/src/main.rs#L643

Is that what's going on here? Is it some sort of race, where I try to get the account before the transaction has committed?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, when push_transactions() returns the txs have been queued but not
guaranteed to have been processed and included in a block.

The code that create accounts is very involved, not sure it's easy to change
to guarantee this.

Ok(_account) => {
rpc_time.stop();
stats.success += 1;
stats.total_success_time_us += rpc_time.as_us();
}
Err(e) => {
rpc_time.stop();
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);
last_error = Instant::now();
}
}
}
}
RpcBench::Slot => {
let mut rpc_time = Measure::start("rpc-get-slot");
match client.get_slot() {
Expand Down
Loading