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

TransactionView: ReceiveAndBuffer #3820

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 13 additions & 1 deletion banking-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use {
solana_core::{
banking_stage::BankingStage,
banking_trace::{BankingPacketBatch, BankingTracer, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT},
validator::BlockProductionMethod,
validator::{BlockProductionMethod, TransactionStructure},
},
solana_gossip::cluster_info::{ClusterInfo, Node},
solana_ledger::{
Expand Down Expand Up @@ -288,6 +288,14 @@ fn main() {
.possible_values(BlockProductionMethod::cli_names())
.help(BlockProductionMethod::cli_message()),
)
.arg(
Arg::with_name("transaction_struct")
.long("transaction-structure")
.value_name("STRUCT")
.takes_value(true)
.possible_values(TransactionStructure::cli_names())
.help(TransactionStructure::cli_message()),
)
.arg(
Arg::new("num_banking_threads")
.long("num-banking-threads")
Expand Down Expand Up @@ -318,6 +326,9 @@ fn main() {
let block_production_method = matches
.value_of_t::<BlockProductionMethod>("block_production_method")
.unwrap_or_default();
let transaction_struct = matches
.value_of_t::<TransactionStructure>("transaction_struct")
.unwrap_or_default();
let num_banking_threads = matches
.value_of_t::<u32>("num_banking_threads")
.unwrap_or_else(|_| BankingStage::num_threads());
Expand Down Expand Up @@ -462,6 +473,7 @@ fn main() {
};
let banking_stage = BankingStage::new_num_threads(
block_production_method,
transaction_struct,
&cluster_info,
&poh_recorder,
non_vote_receiver,
Expand Down
1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ edition = { workspace = true }
codecov = { repository = "solana-labs/solana", branch = "master", service = "github" }

[dependencies]
agave-transaction-view = { workspace = true }
ahash = { workspace = true }
anyhow = { workspace = true }
arrayvec = { workspace = true }
Expand Down
80 changes: 73 additions & 7 deletions core/benches/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![feature(test)]

use {
solana_core::validator::BlockProductionMethod,
solana_core::validator::{BlockProductionMethod, TransactionStructure},
solana_vote_program::{vote_state::TowerSync, vote_transaction::new_tower_sync_transaction},
};

Expand Down Expand Up @@ -192,7 +192,12 @@ enum TransactionType {
ProgramsAndVotes,
}

fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
fn bench_banking(
bencher: &mut Bencher,
tx_type: TransactionType,
block_production_method: BlockProductionMethod,
transaction_struct: TransactionStructure,
) {
solana_logger::setup();
let num_threads = BankingStage::num_threads() as usize;
// a multiple of packet chunk duplicates to avoid races
Expand Down Expand Up @@ -291,7 +296,8 @@ fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
let cluster_info = Arc::new(cluster_info);
let (s, _r) = unbounded();
let _banking_stage = BankingStage::new(
BlockProductionMethod::CentralScheduler,
block_production_method,
transaction_struct,
&cluster_info,
&poh_recorder,
non_vote_receiver,
Expand Down Expand Up @@ -368,22 +374,82 @@ fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {

#[bench]
fn bench_banking_stage_multi_accounts(bencher: &mut Bencher) {
bench_banking(bencher, TransactionType::Accounts);
bench_banking(
bencher,
TransactionType::Accounts,
BlockProductionMethod::CentralScheduler,
TransactionStructure::Sdk,
);
}

#[bench]
fn bench_banking_stage_multi_programs(bencher: &mut Bencher) {
bench_banking(bencher, TransactionType::Programs);
bench_banking(
bencher,
TransactionType::Programs,
BlockProductionMethod::CentralScheduler,
TransactionStructure::Sdk,
);
}

#[bench]
fn bench_banking_stage_multi_accounts_with_voting(bencher: &mut Bencher) {
bench_banking(bencher, TransactionType::AccountsAndVotes);
bench_banking(
bencher,
TransactionType::AccountsAndVotes,
BlockProductionMethod::CentralScheduler,
TransactionStructure::Sdk,
);
}

#[bench]
fn bench_banking_stage_multi_programs_with_voting(bencher: &mut Bencher) {
bench_banking(bencher, TransactionType::ProgramsAndVotes);
bench_banking(
bencher,
TransactionType::ProgramsAndVotes,
BlockProductionMethod::CentralScheduler,
TransactionStructure::Sdk,
);
}

#[bench]
fn bench_banking_stage_multi_accounts_view(bencher: &mut Bencher) {
bench_banking(
bencher,
TransactionType::Accounts,
BlockProductionMethod::CentralScheduler,
TransactionStructure::View,
);
}

#[bench]
fn bench_banking_stage_multi_programs_view(bencher: &mut Bencher) {
bench_banking(
bencher,
TransactionType::Programs,
BlockProductionMethod::CentralScheduler,
TransactionStructure::View,
);
}

#[bench]
fn bench_banking_stage_multi_accounts_with_voting_view(bencher: &mut Bencher) {
bench_banking(
bencher,
TransactionType::AccountsAndVotes,
BlockProductionMethod::CentralScheduler,
TransactionStructure::View,
);
}

#[bench]
fn bench_banking_stage_multi_programs_with_voting_view(bencher: &mut Bencher) {
bench_banking(
bencher,
TransactionType::ProgramsAndVotes,
BlockProductionMethod::CentralScheduler,
TransactionStructure::View,
);
}

fn simulate_process_entries(
Expand Down
6 changes: 5 additions & 1 deletion core/src/banking_simulation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use {
BankingPacketBatch, BankingTracer, ChannelLabel, TimedTracedEvent, TracedEvent,
TracedSender, TracerThread, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT, BASENAME,
},
validator::BlockProductionMethod,
validator::{BlockProductionMethod, TransactionStructure},
},
bincode::deserialize_from,
crossbeam_channel::{unbounded, Sender},
Expand Down Expand Up @@ -672,6 +672,7 @@ impl BankingSimulator {
bank_forks: Arc<RwLock<BankForks>>,
blockstore: Arc<Blockstore>,
block_production_method: BlockProductionMethod,
transaction_struct: TransactionStructure,
) -> (SenderLoop, SimulatorLoop, SimulatorThreads) {
let parent_slot = self.parent_slot().unwrap();
let mut packet_batches_by_time = self.banking_trace_events.packet_batches_by_time;
Expand Down Expand Up @@ -802,6 +803,7 @@ impl BankingSimulator {
let prioritization_fee_cache = &Arc::new(PrioritizationFeeCache::new(0u64));
let banking_stage = BankingStage::new_num_threads(
block_production_method.clone(),
transaction_struct.clone(),
&cluster_info,
&poh_recorder,
non_vote_receiver,
Expand Down Expand Up @@ -889,12 +891,14 @@ impl BankingSimulator {
bank_forks: Arc<RwLock<BankForks>>,
blockstore: Arc<Blockstore>,
block_production_method: BlockProductionMethod,
transaction_struct: TransactionStructure,
) -> Result<(), SimulateError> {
let (sender_loop, simulator_loop, simulator_threads) = self.prepare_simulation(
genesis_config,
bank_forks,
blockstore,
block_production_method,
transaction_struct,
);

sender_loop.log_starting();
Expand Down
Loading
Loading