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

Add fully-reproducible online tracer for banking #29196

Merged
merged 43 commits into from
Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
01faa66
Add fully-reproducible online tracer for banking
ryoqun Dec 10, 2022
fc4f778
Don't use eprintln!()...
ryoqun Dec 10, 2022
ec83707
Update programs/sbf/Cargo.lock...
ryoqun Dec 10, 2022
2257bd0
Remove meaningless assert_eq
ryoqun Dec 10, 2022
b5b495e
Group test-only code under aptly named mod
ryoqun Dec 10, 2022
2aa1872
Remove needless overflow handling in receive_until
ryoqun Dec 11, 2022
f046ee5
Delay stat aggregation as it's possible now
ryoqun Dec 11, 2022
b8edf77
Use Cow to avoid needless heap allocs
ryoqun Dec 11, 2022
0ff201a
Properly consume metrics action as soon as hold
ryoqun Dec 12, 2022
02a0a4c
Trace UnprocessedTransactionStorage::len() instead
ryoqun Dec 12, 2022
52b09d7
Loosen joining api over type safety for replaystage
ryoqun Dec 16, 2022
e8d49be
Introce hash event to override these when simulating
ryoqun Dec 16, 2022
ebf408a
Use serde_with/serde_as instead of hacky workaround
ryoqun Dec 19, 2022
9dd971b
Update another Cargo.lock...
ryoqun Dec 19, 2022
2a78d19
Add detailed comment for Packet::buffer serialize
ryoqun Dec 19, 2022
24ffc48
Rename sender_overhead_minimized_receiver_loop()
ryoqun Dec 19, 2022
ffbcb92
Use type interference for TraceError
ryoqun Dec 19, 2022
28a30ed
Another minor rename
ryoqun Dec 19, 2022
bd0caa7
Retire now useless ForEach to simplify code
ryoqun Dec 20, 2022
5118cd8
Use type alias as much as possible
ryoqun Dec 20, 2022
ee044d4
Properly translate and propagate tracing errors
ryoqun Dec 20, 2022
8d1d522
Clarify --enable-banking-trace with better naming
ryoqun Dec 20, 2022
fb608ff
Consider unclean (signal-based) node restarts..
ryoqun Dec 21, 2022
874820e
Tweak logging and cli
ryoqun Dec 21, 2022
33f6fb8
Remove Bank events as it's not needed anymore
ryoqun Jan 13, 2023
3e83eac
Make tpu own banking tracer thread
ryoqun Jan 14, 2023
c4b90bb
Reduce diff a bit..
ryoqun Jan 14, 2023
6c5dd57
Use latest serde_with
ryoqun Jan 15, 2023
88b2b50
Finally use the published rolling-file crate
ryoqun Jan 18, 2023
907d59f
Make test code change more consistent
ryoqun Jan 24, 2023
8755444
Revive dead and non-terminating test code path...
ryoqun Jan 24, 2023
8461c95
Dispose batches early now that possible
ryoqun Jan 24, 2023
9c2d4c7
Split off thread handle very early at ::new()
ryoqun Jan 24, 2023
b4ea132
Tweak message for TooSmallDirByteLimitl
ryoqun Jan 25, 2023
c754b4e
Remove too much of indirection
ryoqun Jan 25, 2023
10cf905
Remove needless pub from ::channel()
ryoqun Jan 25, 2023
22ff340
Clarify test comments
ryoqun Jan 25, 2023
8ca2529
Avoid needless event creation if tracer is disabled
ryoqun Jan 25, 2023
30971c3
Write tests around file rotation and spill-over
ryoqun Jan 25, 2023
420d95e
Remove unneeded PathBuf::clone()s...
ryoqun Jan 25, 2023
54042b2
Introduce inner struct instead of tuple...
ryoqun Jan 25, 2023
b7ac53b
Remove unused enum BankStatus...
ryoqun Jan 25, 2023
84e9520
Avoid .unwrap() for the case of disabled tracer...
ryoqun Jan 25, 2023
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
74 changes: 74 additions & 0 deletions Cargo.lock

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

30 changes: 25 additions & 5 deletions banking-bench/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use {
rand::{thread_rng, Rng},
rayon::prelude::*,
solana_client::connection_cache::ConnectionCache,
solana_core::banking_stage::BankingStage,
solana_core::{
banking_stage::BankingStage,
banking_trace::{BankingPacketBatch, BankingTracer, BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT},
},
solana_gossip::cluster_info::{ClusterInfo, Node},
solana_ledger::{
blockstore::Blockstore,
Expand Down Expand Up @@ -255,6 +258,12 @@ fn main() {
.takes_value(false)
.help("Skip transaction sanity execution"),
)
.arg(
Arg::new("trace_banking")
.long("trace-banking")
.takes_value(false)
.help("Enable banking tracing"),
)
.arg(
Arg::new("write_lock_contention")
.long("write-lock-contention")
Expand Down Expand Up @@ -407,9 +416,17 @@ fn main() {
let leader_schedule_cache = Arc::new(LeaderScheduleCache::new_from_bank(&bank));
let (exit, poh_recorder, poh_service, signal_receiver) =
create_test_recorder(&bank, &blockstore, None, Some(leader_schedule_cache));
let (non_vote_sender, non_vote_receiver) = unbounded();
let (tpu_vote_sender, tpu_vote_receiver) = unbounded();
let (gossip_vote_sender, gossip_vote_receiver) = unbounded();
let (banking_tracer, tracer_thread) =
BankingTracer::new(matches.is_present("trace_banking").then_some((
&blockstore.banking_trace_path(),
exit.clone(),
BANKING_TRACE_DIR_DEFAULT_BYTE_LIMIT,
)))
.unwrap();
let (non_vote_sender, non_vote_receiver) = banking_tracer.create_channel_non_vote();
let (tpu_vote_sender, tpu_vote_receiver) = banking_tracer.create_channel_tpu_vote();
let (gossip_vote_sender, gossip_vote_receiver) =
banking_tracer.create_channel_gossip_vote();
let cluster_info = {
let keypair = Arc::new(Keypair::new());
let node = Node::new_localhost_with_pubkey(&keypair.pubkey());
Expand Down Expand Up @@ -462,7 +479,7 @@ fn main() {
timestamp(),
);
non_vote_sender
.send((vec![packet_batch.clone()], None))
.send(BankingPacketBatch::new((vec![packet_batch.clone()], None)))
.unwrap();
}

Expand Down Expand Up @@ -583,6 +600,9 @@ fn main() {
poh_service.join().unwrap();
sleep(Duration::from_secs(1));
debug!("waited for poh_service");
if let Some(tracer_thread) = tracer_thread {
tracer_thread.join().unwrap().unwrap();
}
}
let _unused = Blockstore::destroy(&ledger_path);
}
1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ num_enum = "0.5.7"
rand = "0.7.0"
rand_chacha = "0.2.2"
rayon = "1.5.3"
rolling-file = "0.2.0"
serde = "1.0.144"
serde_derive = "1.0.103"
solana-address-lookup-table-program = { path = "../programs/address-lookup-table", version = "=1.15.0" }
Expand Down
22 changes: 16 additions & 6 deletions core/benches/banking_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use {
solana_client::connection_cache::ConnectionCache,
solana_core::{
banking_stage::{BankingStage, BankingStageStats},
banking_trace::{BankingPacketBatch, BankingTracer},
leader_slot_banking_stage_metrics::LeaderSlotMetricsTracker,
qos_service::QosService,
unprocessed_packet_batches::*,
Expand Down Expand Up @@ -197,9 +198,10 @@ fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
// during the benchmark
genesis_config.ticks_per_slot = 10_000;

let (non_vote_sender, non_vote_receiver) = unbounded();
let (tpu_vote_sender, tpu_vote_receiver) = unbounded();
let (gossip_vote_sender, gossip_vote_receiver) = unbounded();
let banking_tracer = BankingTracer::new_disabled();
let (non_vote_sender, non_vote_receiver) = banking_tracer.create_channel_non_vote();
let (tpu_vote_sender, tpu_vote_receiver) = banking_tracer.create_channel_tpu_vote();
let (gossip_vote_sender, gossip_vote_receiver) = banking_tracer.create_channel_gossip_vote();

let mut bank = Bank::new_for_benches(&genesis_config);
// Allow arbitrary transaction processing time for the purposes of this bench
Expand Down Expand Up @@ -304,10 +306,16 @@ fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
let mut sent = 0;
if let Some(vote_packets) = &vote_packets {
tpu_vote_sender
.send((vote_packets[start..start + chunk_len].to_vec(), None))
.send(BankingPacketBatch::new((
vote_packets[start..start + chunk_len].to_vec(),
None,
)))
.unwrap();
gossip_vote_sender
.send((vote_packets[start..start + chunk_len].to_vec(), None))
.send(BankingPacketBatch::new((
vote_packets[start..start + chunk_len].to_vec(),
None,
)))
.unwrap();
}
for v in verified[start..start + chunk_len].chunks(chunk_len / num_threads) {
Expand All @@ -321,7 +329,9 @@ fn bench_banking(bencher: &mut Bencher, tx_type: TransactionType) {
for xv in v {
sent += xv.len();
}
non_vote_sender.send((v.to_vec(), None)).unwrap();
non_vote_sender
.send(BankingPacketBatch::new((v.to_vec(), None)))
.unwrap();
}

check_txs(&signal_receiver2, txes / CHUNKS);
Expand Down
Loading