ledger: confirm_slot_entries(): confirmation_elapsed metric (#30807)

Measure total time spent inside `confirm_slot_entries()`.  Useful metric
in addition to `replay_elapsed` and
`poh_verify_elapsed`/`transaction_verify_elapsed`, as it shows how PoH
and transaction verification interact with the replay process.
This commit is contained in:
Illia Bobyr 2023-03-29 13:11:29 -07:00 committed by GitHub
parent ecd3279af9
commit fe5ae7733b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 0 deletions

1
Cargo.lock generated
View File

@ -5781,6 +5781,7 @@ dependencies = [
"reed-solomon-erasure",
"rocksdb",
"rustc_version 0.4.0",
"scopeguard",
"serde",
"serde_bytes",
"sha2 0.10.6",

View File

@ -64,6 +64,7 @@ impl ReplaySlotStats {
self.transaction_verify_elapsed as i64,
i64
),
("confirmation_time_us", self.confirmation_elapsed as i64, i64),
("replay_time", self.replay_elapsed as i64, i64),
("execute_batches_us", self.batch_execute.wall_clock_us as i64, i64),
(

View File

@ -32,6 +32,7 @@ rand = { workspace = true }
rand_chacha = { workspace = true }
rayon = { workspace = true }
reed-solomon-erasure = { workspace = true, features = ["simd-accel"] }
scopeguard = { workspace = true }
serde = { workspace = true }
serde_bytes = { workspace = true }
sha2 = { workspace = true }

View File

@ -10,6 +10,7 @@ use {
log::*,
rand::{seq::SliceRandom, thread_rng},
rayon::{prelude::*, ThreadPool},
scopeguard::defer,
solana_entry::entry::{
self, create_ticks, Entry, EntrySlice, EntryType, EntryVerificationStatus, VerifyRecyclers,
},
@ -934,6 +935,12 @@ pub struct ConfirmationTiming {
/// slot is complete.
pub started: Instant,
/// Wall clock time used by the slot confirmation code, including PoH/signature verification,
/// and replay. As replay can run in parallel with the verification, this value can not be
/// recovered from the `replay_elapsed` and or `{poh,transaction}_verify_elapsed`. This
/// includes failed cases, when `confirm_slot_entries` exist with an error. In microseconds.
pub confirmation_elapsed: u64,
/// Wall clock time used by the entry replay code. Does not include the PoH or the transaction
/// signature/precompiles verification, but can overlap with the PoH and signature verification.
/// In microseconds.
@ -962,6 +969,7 @@ impl Default for ConfirmationTiming {
fn default() -> Self {
Self {
started: Instant::now(),
confirmation_elapsed: 0,
replay_elapsed: 0,
poh_verify_elapsed: 0,
transaction_verify_elapsed: 0,
@ -1096,6 +1104,7 @@ fn confirm_slot_entries(
prioritization_fee_cache: &PrioritizationFeeCache,
) -> result::Result<(), BlockstoreProcessorError> {
let ConfirmationTiming {
confirmation_elapsed,
replay_elapsed,
poh_verify_elapsed,
transaction_verify_elapsed,
@ -1103,6 +1112,11 @@ fn confirm_slot_entries(
..
} = timing;
let confirmation_elapsed_timer = Measure::start("confirmation_elapsed");
defer! {
*confirmation_elapsed += confirmation_elapsed_timer.end_as_us();
};
let slot = bank.slot();
let (entries, num_shreds, slot_full) = slot_entries_load_result;
let num_entries = entries.len();

View File

@ -4923,6 +4923,7 @@ dependencies = [
"reed-solomon-erasure",
"rocksdb",
"rustc_version 0.4.0",
"scopeguard",
"serde",
"serde_bytes",
"sha2 0.10.6",