Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
174 changes: 172 additions & 2 deletions Cargo.lock

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

9 changes: 9 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ members = [
"crates/trie/sparse",
"crates/trie/sparse-parallel/",
"crates/trie/trie",
"crates/triedb/common",
"crates/triedb/db/memorydb",
"crates/triedb/db/pathdb",
"crates/triedb/state-trie",
"crates/triedb/smoke-test",
"examples/beacon-api-sidecar-fetcher/",
"examples/beacon-api-sse/",
"examples/bsc-p2p",
Expand Down Expand Up @@ -449,6 +454,10 @@ reth-trie-db = { path = "crates/trie/db" }
reth-trie-parallel = { path = "crates/trie/parallel" }
reth-trie-sparse = { path = "crates/trie/sparse", default-features = false }
reth-trie-sparse-parallel = { path = "crates/trie/sparse-parallel" }
reth-triedb-common = { path = "crates/triedb/common" }
reth-triedb-memorydb = { path = "crates/triedb/db/memorydb" }
reth-triedb-pathdb = { path = "crates/triedb/db/pathdb" }
reth-triedb-state-trie = { path = "crates/triedb/state-trie" }
reth-zstd-compressors = { path = "crates/storage/zstd-compressors", default-features = false }
reth-ress-protocol = { path = "crates/ress/protocol" }
reth-ress-provider = { path = "crates/ress/provider" }
Expand Down
50 changes: 41 additions & 9 deletions crates/engine/tree/src/tree/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ pub(crate) struct EngineMetrics {
pub(crate) failed_new_payload_response_deliveries: Counter,
/// Tracks the how often we failed to deliver a forkchoice update response.
pub(crate) failed_forkchoice_updated_response_deliveries: Counter,
// TODO add latency metrics

/// Overall block processing duration (from start to finish)
pub(crate) block_total_duration: Histogram,
/// Overall Block execution duration during live sync
pub(crate) block_execution_duration: Histogram,
/// Overall validation duration (from start to finish, excluding execution)
pub(crate) block_validation_duration: Histogram,
}

/// Metrics for non-execution related block validation.
Expand All @@ -65,25 +71,51 @@ pub(crate) struct BlockValidationMetrics {
pub(crate) state_root_storage_tries_updated_total: Counter,
/// Total number of times the parallel state root computation fell back to regular.
pub(crate) state_root_parallel_fallback_total: Counter,
/// Histogram of state root duration
pub(crate) state_root_histogram: Histogram,
/// Latest state root duration
pub(crate) state_root_duration: Gauge,
/// Trie input computation duration
pub(crate) trie_input_duration: Histogram,
/// Payload conversion and validation latency
pub(crate) payload_validation_duration: Gauge,
/// Histogram of payload validation latency
pub(crate) payload_validation_histogram: Histogram,

/// Total number of background parallel state root tasks (historical cumulative)
#[allow(dead_code)]
pub background_parallel_state_root_tasks: Counter,
/// Total number of foreground parallel state root tasks (historical cumulative)
#[allow(dead_code)]
pub foreground_parallel_state_root_tasks: Counter,
/// Total number of background cache tasks (historical cumulative)
#[allow(dead_code)]
pub background_cache_tasks: Counter,
/// Total number of foreground sync state root computations (historical cumulative)
#[allow(dead_code)]
pub faillback_sync_state_root_tasks: Counter,

/// State root computation duration (parallel)
pub state_root_parallel_duration: Histogram,
/// State root computation duration (serial)
pub state_root_serial_duration: Histogram,
}

impl BlockValidationMetrics {
/// Records a new state root time, updating both the histogram and state root gauge
pub(crate) fn record_state_root(&self, trie_output: &TrieUpdates, elapsed_as_secs: f64) {
/// Records comprehensive state root computation metrics for live sync
/// This includes both the original metrics and the new live sync performance metrics
pub(crate) fn record_state_root(
&self,
trie_output: &TrieUpdates,
elapsed_as_secs: f64,
is_parallel: bool,
) {
// Record storage tries count
self.state_root_storage_tries_updated_total
.increment(trie_output.storage_tries_ref().len() as u64);
self.state_root_duration.set(elapsed_as_secs);
self.state_root_histogram.record(elapsed_as_secs);

// Record live sync specific metrics
if is_parallel {
self.state_root_parallel_duration.record(elapsed_as_secs);
} else {
self.state_root_serial_duration.record(elapsed_as_secs);
}
}

/// Records a new payload validation time, updating both the histogram and the payload
Expand Down
Loading