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

Conversation

steveluscher
Copy link

@steveluscher steveluscher commented Dec 5, 2024

Summary of Changes

cd accounts-cluster-bench/
cargo run -- --identity ~/.config/solana/id.json --rpc-bench account-info --iterations 0 --url l

[2024-12-05T22:23:35.196026504Z INFO  solana_accounts_cluster_bench] creating 4 new
[2024-12-05T22:23:35.196792009Z INFO  solana_accounts_cluster_bench] txs: 4
[2024-12-05T22:23:35.202978709Z INFO  solana_accounts_cluster_bench] ids: 4
[2024-12-05T22:23:35.203003136Z INFO  solana_accounts_cluster_bench] total_accounts_created: 368 total_accounts_closed: 0 tx_sent_count: 368 loop_count: 103 balance(s): [732814816240]
[2024-12-05T22:23:35.426296399Z INFO  solana_accounts_cluster_bench] t(0) rpc(AccountInfo) iters: 67827 success: 5228 errors: 19
[2024-12-05T22:23:35.426334171Z INFO  solana_accounts_cluster_bench]  t(0) rpc(AccountInfo average success_time: 761 us
[2024-12-05T22:23:35.426344090Z INFO  solana_accounts_cluster_bench]  rpc average average errors time: 718 us

Related: #3242.

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.

let seed = thread_rng().gen_range(seed_range).to_string();
let account_pubkey =
Pubkey::create_with_seed(&base_keypair_pubkey, &seed, &program_id).unwrap();
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.

info!("get_account_info: No accounts have yet been created; skipping");
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.

@steveluscher steveluscher added the automerge automerge Merge this Pull Request automatically once CI passes label Dec 6, 2024
Copy link

mergify bot commented Dec 6, 2024

automerge label removed due to a CI failure

@mergify mergify bot removed the automerge automerge Merge this Pull Request automatically once CI passes label Dec 6, 2024
@steveluscher steveluscher force-pushed the get-account-info-benchmark branch from 3104efa to 0b0d539 Compare December 6, 2024 06:35
@@ -683,6 +720,8 @@ fn run_accounts_bench(
let _ = executor.drain_cleared();
}

start_bench_tx.send(()).unwrap();

Choose a reason for hiding this comment

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

won't this only unblock one of the bench threads?

For this kind of stuff, I think
https://doc.rust-lang.org/stable/std/sync/struct.Barrier.html would be more idiomatic

Choose a reason for hiding this comment

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

Ah, looks like stacking got me already 😅

Copy link
Author

Choose a reason for hiding this comment

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

won't this only unblock one of the bench threads?

Dude, I don't know how computers work.

ty for the pointer.

Copy link
Author

Choose a reason for hiding this comment

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

@nickfrosty, this is – in my opinion – a perfect example of what we were talking about earlier today. In this particular instance I was on the ‘don't know what I don't know‘ side of the house. I needed a guide on synchronization primitives. I spent a ton of time with the Rust API docs, but they didn't lead me to the right solution. Furthermore, as soon as Alessandro gave me the pointer to Barrier, I no longer had any use for the web-based API docs; I found all the answers I needed in the Rust LSP / the code itself.

@alessandrod alessandrod self-requested a review December 7, 2024 01:38
alessandrod
alessandrod previously approved these changes Dec 7, 2024
Copy link

@alessandrod alessandrod left a comment

Choose a reason for hiding this comment

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

The bench here looks good. For the channel unblock thing, see the other PR.

@steveluscher
Copy link
Author

Updated to use Barrier for synchronization. Moved timer so as not to time stuff we don't care about.

@steveluscher steveluscher force-pushed the get-account-info-benchmark branch from 0917e14 to 93fae78 Compare December 7, 2024 06:42
@steveluscher
Copy link
Author

Actually, dropped the synchronization in this PR in favour of #3960. Must land that first before this.

Copy link

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

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

r+ #3960 landing first

@steveluscher steveluscher requested a review from t-nelson December 9, 2024 08:08
@steveluscher steveluscher force-pushed the get-account-info-benchmark branch from 735584b to c0ede40 Compare December 9, 2024 08:10
@steveluscher steveluscher force-pushed the get-account-info-benchmark branch from c0ede40 to 42da0f9 Compare December 9, 2024 08:31
@steveluscher steveluscher merged commit bd04d77 into anza-xyz:master Dec 9, 2024
40 checks passed
@steveluscher steveluscher deleted the get-account-info-benchmark branch December 9, 2024 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants