Skip to content

Commit 535ea1e

Browse files
authored
TransactionView: ReceiveAndBuffer (anza-xyz#3820)
1 parent d3dc3d0 commit 535ea1e

File tree

24 files changed

+884
-196
lines changed

24 files changed

+884
-196
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

banking-bench/src/main.rs

+13-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use {
1111
solana_core::{
1212
banking_stage::{update_bank_forks_and_poh_recorder_for_new_tpu_bank, BankingStage},
1313
banking_trace::{BankingTracer, Channels, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT},
14-
validator::BlockProductionMethod,
14+
validator::{BlockProductionMethod, TransactionStructure},
1515
},
1616
solana_gossip::cluster_info::{ClusterInfo, Node},
1717
solana_ledger::{
@@ -290,6 +290,14 @@ fn main() {
290290
.possible_values(BlockProductionMethod::cli_names())
291291
.help(BlockProductionMethod::cli_message()),
292292
)
293+
.arg(
294+
Arg::with_name("transaction_struct")
295+
.long("transaction-structure")
296+
.value_name("STRUCT")
297+
.takes_value(true)
298+
.possible_values(TransactionStructure::cli_names())
299+
.help(TransactionStructure::cli_message()),
300+
)
293301
.arg(
294302
Arg::new("num_banking_threads")
295303
.long("num-banking-threads")
@@ -320,6 +328,9 @@ fn main() {
320328
let block_production_method = matches
321329
.value_of_t::<BlockProductionMethod>("block_production_method")
322330
.unwrap_or_default();
331+
let transaction_struct = matches
332+
.value_of_t::<TransactionStructure>("transaction_struct")
333+
.unwrap_or_default();
323334
let num_banking_threads = matches
324335
.value_of_t::<u32>("num_banking_threads")
325336
.unwrap_or_else(|_| BankingStage::num_threads());
@@ -470,6 +481,7 @@ fn main() {
470481
};
471482
let banking_stage = BankingStage::new_num_threads(
472483
block_production_method,
484+
transaction_struct,
473485
&cluster_info,
474486
&poh_recorder,
475487
non_vote_receiver,

core/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ codecov = { repository = "solana-labs/solana", branch = "master", service = "git
1515

1616
[dependencies]
1717
agave-banking-stage-ingress-types = { workspace = true }
18+
agave-transaction-view = { workspace = true }
1819
ahash = { workspace = true }
1920
anyhow = { workspace = true }
2021
arrayvec = { workspace = true }

core/benches/banking_stage.rs

+76-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33

44
use {
55
agave_banking_stage_ingress_types::BankingPacketBatch,
6-
solana_core::{banking_trace::Channels, validator::BlockProductionMethod},
6+
solana_core::{
7+
banking_trace::Channels,
8+
validator::{BlockProductionMethod, TransactionStructure},
9+
},
710
solana_vote_program::{vote_state::TowerSync, vote_transaction::new_tower_sync_transaction},
811
};
912

@@ -193,7 +196,12 @@ enum TransactionType {
193196
ProgramsAndVotes,
194197
}
195198

196-
fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
199+
fn bench_banking(
200+
bencher: &mut Bencher,
201+
tx_type: TransactionType,
202+
block_production_method: BlockProductionMethod,
203+
transaction_struct: TransactionStructure,
204+
) {
197205
solana_logger::setup();
198206
let num_threads = BankingStage::num_threads() as usize;
199207
// a multiple of packet chunk duplicates to avoid races
@@ -297,7 +305,8 @@ fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
297305
let cluster_info = Arc::new(cluster_info);
298306
let (s, _r) = unbounded();
299307
let _banking_stage = BankingStage::new(
300-
BlockProductionMethod::CentralScheduler,
308+
block_production_method,
309+
transaction_struct,
301310
&cluster_info,
302311
&poh_recorder,
303312
non_vote_receiver,
@@ -372,22 +381,82 @@ fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
372381

373382
#[bench]
374383
fn bench_banking_stage_multi_accounts(bencher: &mut Bencher) {
375-
bench_banking(bencher, TransactionType::Accounts);
384+
bench_banking(
385+
bencher,
386+
TransactionType::Accounts,
387+
BlockProductionMethod::CentralScheduler,
388+
TransactionStructure::Sdk,
389+
);
376390
}
377391

378392
#[bench]
379393
fn bench_banking_stage_multi_programs(bencher: &mut Bencher) {
380-
bench_banking(bencher, TransactionType::Programs);
394+
bench_banking(
395+
bencher,
396+
TransactionType::Programs,
397+
BlockProductionMethod::CentralScheduler,
398+
TransactionStructure::Sdk,
399+
);
381400
}
382401

383402
#[bench]
384403
fn bench_banking_stage_multi_accounts_with_voting(bencher: &mut Bencher) {
385-
bench_banking(bencher, TransactionType::AccountsAndVotes);
404+
bench_banking(
405+
bencher,
406+
TransactionType::AccountsAndVotes,
407+
BlockProductionMethod::CentralScheduler,
408+
TransactionStructure::Sdk,
409+
);
386410
}
387411

388412
#[bench]
389413
fn bench_banking_stage_multi_programs_with_voting(bencher: &mut Bencher) {
390-
bench_banking(bencher, TransactionType::ProgramsAndVotes);
414+
bench_banking(
415+
bencher,
416+
TransactionType::ProgramsAndVotes,
417+
BlockProductionMethod::CentralScheduler,
418+
TransactionStructure::Sdk,
419+
);
420+
}
421+
422+
#[bench]
423+
fn bench_banking_stage_multi_accounts_view(bencher: &mut Bencher) {
424+
bench_banking(
425+
bencher,
426+
TransactionType::Accounts,
427+
BlockProductionMethod::CentralScheduler,
428+
TransactionStructure::View,
429+
);
430+
}
431+
432+
#[bench]
433+
fn bench_banking_stage_multi_programs_view(bencher: &mut Bencher) {
434+
bench_banking(
435+
bencher,
436+
TransactionType::Programs,
437+
BlockProductionMethod::CentralScheduler,
438+
TransactionStructure::View,
439+
);
440+
}
441+
442+
#[bench]
443+
fn bench_banking_stage_multi_accounts_with_voting_view(bencher: &mut Bencher) {
444+
bench_banking(
445+
bencher,
446+
TransactionType::AccountsAndVotes,
447+
BlockProductionMethod::CentralScheduler,
448+
TransactionStructure::View,
449+
);
450+
}
451+
452+
#[bench]
453+
fn bench_banking_stage_multi_programs_with_voting_view(bencher: &mut Bencher) {
454+
bench_banking(
455+
bencher,
456+
TransactionType::ProgramsAndVotes,
457+
BlockProductionMethod::CentralScheduler,
458+
TransactionStructure::View,
459+
);
391460
}
392461

393462
fn simulate_process_entries(

core/src/banking_simulation.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use {
88
BankingTracer, ChannelLabel, Channels, TimedTracedEvent, TracedEvent, TracedSender,
99
TracerThread, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT, BASENAME,
1010
},
11-
validator::BlockProductionMethod,
11+
validator::{BlockProductionMethod, TransactionStructure},
1212
},
1313
agave_banking_stage_ingress_types::BankingPacketBatch,
1414
assert_matches::assert_matches,
@@ -676,6 +676,7 @@ impl BankingSimulator {
676676
bank_forks: Arc<RwLock<BankForks>>,
677677
blockstore: Arc<Blockstore>,
678678
block_production_method: BlockProductionMethod,
679+
transaction_struct: TransactionStructure,
679680
) -> (SenderLoop, SimulatorLoop, SimulatorThreads) {
680681
let parent_slot = self.parent_slot().unwrap();
681682
let mut packet_batches_by_time = self.banking_trace_events.packet_batches_by_time;
@@ -807,6 +808,7 @@ impl BankingSimulator {
807808
let prioritization_fee_cache = &Arc::new(PrioritizationFeeCache::new(0u64));
808809
let banking_stage = BankingStage::new_num_threads(
809810
block_production_method.clone(),
811+
transaction_struct.clone(),
810812
&cluster_info,
811813
&poh_recorder,
812814
non_vote_receiver,
@@ -893,12 +895,14 @@ impl BankingSimulator {
893895
bank_forks: Arc<RwLock<BankForks>>,
894896
blockstore: Arc<Blockstore>,
895897
block_production_method: BlockProductionMethod,
898+
transaction_struct: TransactionStructure,
896899
) -> Result<(), SimulateError> {
897900
let (sender_loop, simulator_loop, simulator_threads) = self.prepare_simulation(
898901
genesis_config,
899902
bank_forks,
900903
blockstore,
901904
block_production_method,
905+
transaction_struct,
902906
);
903907

904908
sender_loop.log_starting();

0 commit comments

Comments
 (0)