Skip to content

Commit

Permalink
Merge branch 'anza-xyz:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
osrm authored Dec 30, 2024
2 parents ea4c392 + c709163 commit eb5984a
Show file tree
Hide file tree
Showing 57 changed files with 2,604 additions and 1,039 deletions.
320 changes: 201 additions & 119 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ members = [
"upload-perf",
"validator",
"version",
"vortexor",
"vote",
"watchtower",
"wen-restart",
Expand Down Expand Up @@ -258,7 +259,7 @@ agave-transaction-view = { path = "transaction-view", version = "=2.2.0" }
aquamarine = "0.3.3"
aes-gcm-siv = "0.11.1"
ahash = "0.8.11"
anyhow = "1.0.94"
anyhow = "1.0.95"
arbitrary = "1.4.1"
ark-bn254 = "0.4.0"
ark-ec = "0.4.0"
Expand All @@ -284,8 +285,8 @@ bs58 = { version = "0.5.1", default-features = false }
bv = "0.11.1"
byte-unit = "4.0.19"
bytecount = "0.6.8"
bytemuck = "1.20.0"
bytemuck_derive = "1.8.0"
bytemuck = "1.21.0"
bytemuck_derive = "1.8.1"
byteorder = "1.5.0"
bytes = "1.9"
bzip2 = "0.4.4"
Expand Down Expand Up @@ -359,7 +360,7 @@ jsonrpc-ipc-server = "18.0.0"
jsonrpc-pubsub = "18.0.0"
lazy-lru = "0.1.3"
lazy_static = "1.5.0"
libc = "0.2.168"
libc = "0.2.169"
libloading = "0.7.4"
libsecp256k1 = { version = "0.6.0", default-features = false, features = [
"std",
Expand Down Expand Up @@ -421,7 +422,7 @@ serde-big-array = "0.5.1"
serde_bytes = "0.11.15"
serde_derive = "1.0.215" # must match the serde version, see https://github.com/serde-rs/serde/issues/2584#issuecomment-1685252251
serde_json = "1.0.133"
serde_with = { version = "3.11.0", default-features = false }
serde_with = { version = "3.12.0", default-features = false }
serde_yaml = "0.9.34"
serial_test = "2.0.0"
sha2 = "0.10.8"
Expand Down Expand Up @@ -646,7 +647,7 @@ tar = "0.4.43"
tarpc = "0.29.0"
tempfile = "3.14.0"
test-case = "3.3.1"
thiserror = "2.0.8"
thiserror = "2.0.9"
tiny-bip39 = "0.8.2"
# Update solana-tokio patch below when updating this version
tokio = "1.29.1"
Expand Down
4 changes: 4 additions & 0 deletions accounts-db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ harness = false
name = "bench_hashing"
harness = false

[[bench]]
name = "read_only_accounts_cache"
harness = false

[[bench]]
name = "bench_serde"
harness = false
Expand Down
33 changes: 6 additions & 27 deletions accounts-db/benches/bench_accounts_file.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#![allow(clippy::arithmetic_side_effects)]
use {
criterion::{criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion, Throughput},
rand::{distributions::WeightedIndex, prelude::*},
rand_chacha::ChaChaRng,
solana_accounts_db::{
accounts_file::StorageAccess,
append_vec::{self, AppendVec, SCAN_BUFFER_SIZE_WITHOUT_DATA},
Expand All @@ -15,13 +13,14 @@ use {
account::{AccountSharedData, ReadableAccount},
clock::Slot,
pubkey::Pubkey,
rent::Rent,
rent_collector::RENT_EXEMPT_RENT_EPOCH,
system_instruction::MAX_PERMITTED_DATA_LENGTH,
},
std::{iter, mem::ManuallyDrop},
std::mem::ManuallyDrop,
};

mod utils;

const ACCOUNTS_COUNTS: [usize; 4] = [
1, // the smallest count; will bench overhead
100, // number of accounts written per slot on mnb (with *no* rent rewrites)
Expand Down Expand Up @@ -116,40 +115,20 @@ fn bench_scan_pubkeys(c: &mut Criterion) {
MAX_PERMITTED_DATA_LENGTH as usize,
];
let weights = [3, 75, 20, 1, 1];
let distribution = WeightedIndex::new(weights).unwrap();

let rent = Rent::default();
let rent_minimum_balances: Vec<_> = data_sizes
.iter()
.map(|data_size| rent.minimum_balance(*data_size))
.collect();

for accounts_count in ACCOUNTS_COUNTS {
group.throughput(Throughput::Elements(accounts_count as u64));
let mut rng = ChaChaRng::seed_from_u64(accounts_count as u64);

let pubkeys: Vec<_> = iter::repeat_with(Pubkey::new_unique)
let storable_accounts: Vec<_> = utils::accounts(255, &data_sizes, &weights)
.take(accounts_count)
.collect();
let accounts: Vec<_> = iter::repeat_with(|| {
let index = distribution.sample(&mut rng);
AccountSharedData::new_rent_epoch(
rent_minimum_balances[index],
data_sizes[index],
&Pubkey::default(),
RENT_EXEMPT_RENT_EPOCH,
)
})
.take(pubkeys.len())
.collect();
let storable_accounts: Vec<_> = iter::zip(&pubkeys, &accounts).collect();

// create an append vec file
let append_vec_path = temp_dir.path().join(format!("append_vec_{accounts_count}"));
_ = std::fs::remove_file(&append_vec_path);
let file_size = accounts
let file_size = storable_accounts
.iter()
.map(|account| append_vec::aligned_stored_size(account.data().len()))
.map(|(_, account)| append_vec::aligned_stored_size(account.data().len()))
.sum();
let append_vec = AppendVec::new(append_vec_path, true, file_size);
let stored_accounts_info = append_vec
Expand Down
Loading

0 comments on commit eb5984a

Please sign in to comment.