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

Merged
merged 30 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
dba1d8d
impl TransactionData for Bytes
apfitzge Nov 26, 2024
2df54af
Optional packet
apfitzge Nov 26, 2024
6043f4d
TransactionViewStateContainer
apfitzge Nov 27, 2024
5ae7019
TransactionViewReceiveAndBuffer
apfitzge Nov 27, 2024
ea485df
spawn_scheduler_and_workers
apfitzge Nov 27, 2024
e7a4eee
convert benches/tests to be switchable
apfitzge Nov 27, 2024
513ff6a
add cli hookup for validator
apfitzge Nov 27, 2024
0ba8bbe
test both ReceiveAndBuffer in scheduler_controller
apfitzge Nov 27, 2024
87c4064
Fix bytes leak on retry
apfitzge Nov 27, 2024
34acab8
receive_and_buffer exit condition fix
apfitzge Nov 27, 2024
9dbcf52
lock bank_forks less often
apfitzge Nov 27, 2024
b702d5c
remove references
apfitzge Dec 2, 2024
e4d5b94
minor sleeping efficiency improvement
apfitzge Dec 3, 2024
81d1826
impl TransactionData for Arc<Vec<u8>>
apfitzge Dec 5, 2024
db9ade6
SharedBytes = Arc<Vec<u8>>
apfitzge Dec 5, 2024
1a05916
only warn about forwarding if not already using Sdk
apfitzge Dec 9, 2024
183a4fd
fix bug on should_forward
apfitzge Dec 9, 2024
da2420d
test_initialize_should_forward
apfitzge Dec 9, 2024
393a8f8
remove option
apfitzge Dec 9, 2024
9c41a65
remove impl TransactionData for Bytes
apfitzge Dec 9, 2024
4e35359
get_vacant_map_entry
apfitzge Dec 9, 2024
58e3aae
Safety comment
apfitzge Dec 9, 2024
aa2bff1
remove SuccessfulInsert type
apfitzge Dec 9, 2024
c215f86
type aliases
apfitzge Dec 9, 2024
fcccad1
remove explicit drop
apfitzge Dec 9, 2024
6e394f4
Remove timeout from testing
apfitzge Dec 10, 2024
113b9ca
should_forward_from_meta
apfitzge Jan 3, 2025
ecd7fb6
typo
apfitzge Jan 3, 2025
63bef62
secp256r1
apfitzge Jan 6, 2025
7fe132f
vote-only discarding
apfitzge Jan 6, 2025
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
1 change: 1 addition & 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 @@ -11,7 +11,7 @@ use {
solana_core::{
banking_stage::{update_bank_forks_and_poh_recorder_for_new_tpu_bank, BankingStage},
banking_trace::{BankingTracer, Channels, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT},
validator::BlockProductionMethod,
validator::{BlockProductionMethod, TransactionStructure},
},
solana_gossip::cluster_info::{ClusterInfo, Node},
solana_ledger::{
Expand Down Expand Up @@ -290,6 +290,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 @@ -320,6 +328,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 @@ -470,6 +481,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 @@ -15,6 +15,7 @@ codecov = { repository = "solana-labs/solana", branch = "master", service = "git

[dependencies]
agave-banking-stage-ingress-types = { workspace = true }
agave-transaction-view = { workspace = true }
ahash = { workspace = true }
anyhow = { workspace = true }
arrayvec = { workspace = true }
Expand Down
83 changes: 76 additions & 7 deletions core/benches/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

use {
agave_banking_stage_ingress_types::BankingPacketBatch,
solana_core::{banking_trace::Channels, validator::BlockProductionMethod},
solana_core::{
banking_trace::Channels,
validator::{BlockProductionMethod, TransactionStructure},
},
solana_vote_program::{vote_state::TowerSync, vote_transaction::new_tower_sync_transaction},
};

Expand Down Expand Up @@ -193,7 +196,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 @@ -297,7 +305,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 @@ -372,22 +381,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 @@ -8,7 +8,7 @@ use {
BankingTracer, ChannelLabel, Channels, TimedTracedEvent, TracedEvent, TracedSender,
TracerThread, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT, BASENAME,
},
validator::BlockProductionMethod,
validator::{BlockProductionMethod, TransactionStructure},
},
agave_banking_stage_ingress_types::BankingPacketBatch,
assert_matches::assert_matches,
Expand Down Expand Up @@ -679,6 +679,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 @@ -810,6 +811,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 @@ -896,12 +898,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