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 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
74a5636
impl TransactionData for Bytes
apfitzge Nov 26, 2024
efd93d9
Optional packet
apfitzge Nov 26, 2024
1dc34d8
TransactionViewStateContainer
apfitzge Nov 27, 2024
9e20b64
TransactionViewReceiveAndBuffer
apfitzge Nov 27, 2024
e20080b
spawn_scheduler_and_workers
apfitzge Nov 27, 2024
64a145f
convert benches/tests to be switchable
apfitzge Nov 27, 2024
7893f9f
add cli hookup for validator
apfitzge Nov 27, 2024
2311eda
test both ReceiveAndBuffer in scheduler_controller
apfitzge Nov 27, 2024
4dbc004
Fix bytes leak on retry
apfitzge Nov 27, 2024
47f3166
receive_and_buffer exit condition fix
apfitzge Nov 27, 2024
f476458
lock bank_forks less often
apfitzge Nov 27, 2024
2cc7295
remove references
apfitzge Dec 2, 2024
ebc62f9
minor sleeping efficiency improvement
apfitzge Dec 3, 2024
ee7f4aa
fix bug with rebase - compute_budget_limits
apfitzge Dec 3, 2024
bafafab
fix conflict w/ sanitize_and_convert_to_compute_budget_limits
apfitzge Dec 5, 2024
190757f
impl TransactionData for Arc<Vec<u8>>
apfitzge Dec 5, 2024
03b78ff
SharedBytes = Arc<Vec<u8>>
apfitzge Dec 5, 2024
082cfe6
only warn about forwarding if not already using Sdk
apfitzge Dec 9, 2024
b6791e3
fix bug on should_forward
apfitzge Dec 9, 2024
216ff6a
test_initialize_should_forward
apfitzge Dec 9, 2024
54381fc
remove option
apfitzge Dec 9, 2024
9cfa069
remove impl TransactionData for Bytes
apfitzge Dec 9, 2024
ae7dc3a
get_vacant_map_entry
apfitzge Dec 9, 2024
b3383cf
Safety comment
apfitzge Dec 9, 2024
1873f61
remove SuccessfulInsert type
apfitzge Dec 9, 2024
5cd4087
type aliases
apfitzge Dec 9, 2024
2db5605
remove explicit drop
apfitzge Dec 9, 2024
d579b84
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 @@ -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 @@ -463,6 +474,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