Skip to content

Commit

Permalink
Improve QS backpressure counter (#13998)
Browse files Browse the repository at this point in the history
  • Loading branch information
igor-aptos authored Jul 16, 2024
1 parent c4c22c4 commit b7baf35
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion consensus/src/quorum_store/batch_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ impl BatchGenerator {
trace!("QS: dynamic_max_pull_txn_per_s: {}", dynamic_pull_txn_per_s);
}
counters::QS_BACKPRESSURE_TXN_COUNT.observe(1.0);
counters::QS_BACKPRESSURE_MAKE_STRICTER_TXN_COUNT.observe(1.0);
counters::QS_BACKPRESSURE_DYNAMIC_MAX.observe(dynamic_pull_txn_per_s as f64);
} else {
// additive increase, every second
Expand All @@ -436,7 +437,10 @@ impl BatchGenerator {
);
trace!("QS: dynamic_max_pull_txn_per_s: {}", dynamic_pull_txn_per_s);
}
counters::QS_BACKPRESSURE_TXN_COUNT.observe(0.0);
counters::QS_BACKPRESSURE_TXN_COUNT.observe(
if dynamic_pull_txn_per_s < self.config.back_pressure.dynamic_max_txn_per_s { 1.0 } else { 0.0 }
);
counters::QS_BACKPRESSURE_MAKE_STRICTER_TXN_COUNT.observe(0.0);
counters::QS_BACKPRESSURE_DYNAMIC_MAX.observe(dynamic_pull_txn_per_s as f64);
}
if self.back_pressure.proof_count {
Expand Down
7 changes: 7 additions & 0 deletions consensus/src/quorum_store/counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,13 @@ pub static QS_BACKPRESSURE_TXN_COUNT: Lazy<Histogram> = Lazy::new(|| {
)
});

pub static QS_BACKPRESSURE_MAKE_STRICTER_TXN_COUNT: Lazy<Histogram> = Lazy::new(|| {
register_avg_counter(
"quorum_store_backpressure_make_stricter_txn_count",
"Indicator of whether Quorum Store txn count backpressure is being made stricter.",
)
});

pub static QS_BACKPRESSURE_PROOF_COUNT: Lazy<Histogram> = Lazy::new(|| {
register_avg_counter(
"quorum_store_backpressure_proof_count",
Expand Down

0 comments on commit b7baf35

Please sign in to comment.