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 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
636261b
impl TransactionData for Bytes
apfitzge Nov 26, 2024
13d46bb
Optional packet
apfitzge Nov 26, 2024
ba825d6
TransactionViewStateContainer
apfitzge Nov 27, 2024
c23a70b
TransactionViewReceiveAndBuffer
apfitzge Nov 27, 2024
0b85632
spawn_scheduler_and_workers
apfitzge Nov 27, 2024
46dfb54
convert benches/tests to be switchable
apfitzge Nov 27, 2024
923e410
add cli hookup for validator
apfitzge Nov 27, 2024
703825a
test both ReceiveAndBuffer in scheduler_controller
apfitzge Nov 27, 2024
d995a77
Fix bytes leak on retry
apfitzge Nov 27, 2024
408fcdf
receive_and_buffer exit condition fix
apfitzge Nov 27, 2024
b094b68
lock bank_forks less often
apfitzge Nov 27, 2024
d616b25
remove references
apfitzge Dec 2, 2024
5a5647b
minor sleeping efficiency improvement
apfitzge Dec 3, 2024
a4050ca
impl TransactionData for Arc<Vec<u8>>
apfitzge Dec 5, 2024
cd92b92
SharedBytes = Arc<Vec<u8>>
apfitzge Dec 5, 2024
eb5bafa
only warn about forwarding if not already using Sdk
apfitzge Dec 9, 2024
6a9b598
fix bug on should_forward
apfitzge Dec 9, 2024
7cbcdc5
test_initialize_should_forward
apfitzge Dec 9, 2024
d2be837
remove option
apfitzge Dec 9, 2024
26635cd
remove impl TransactionData for Bytes
apfitzge Dec 9, 2024
10bd87f
get_vacant_map_entry
apfitzge Dec 9, 2024
87690b6
Safety comment
apfitzge Dec 9, 2024
dfd3cc1
remove SuccessfulInsert type
apfitzge Dec 9, 2024
c6dffd7
type aliases
apfitzge Dec 9, 2024
6190972
remove explicit drop
apfitzge Dec 9, 2024
f2c9d44
Remove timeout from testing
apfitzge Dec 10, 2024
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 {
banking_trace::{
BankingPacketBatch, 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 @@ -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
83 changes: 76 additions & 7 deletions core/benches/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
#![feature(test)]

use {
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 @@ -192,7 +195,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 @@ -296,7 +304,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 @@ -371,22 +380,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 @@ -7,7 +7,7 @@ use {
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 @@ -803,6 +804,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