Skip to content

Commit

Permalink
use average instead of median
Browse files Browse the repository at this point in the history
  • Loading branch information
bchocho committed Dec 11, 2024
1 parent 756e436 commit 24e9448
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
8 changes: 3 additions & 5 deletions config/src/config/consensus_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,11 @@ impl Default for ConsensusConfig {
min_max_txns_in_block_after_filtering_from_backpressure: MIN_BLOCK_TXNS_AFTER_FILTERING,
execution_backpressure: Some(ExecutionBackpressureConfig {
num_blocks_to_look_at: 20,
// TODO: also adjust this?
min_blocks_to_activate: 4,
percentile: 0.5,
percentile: 0.25,
target_block_time_ms: 200,
min_block_time_ms_to_activate: 100,
// TODO: appropriate value?
min_calibrated_block_gas_limit: 1000,
min_block_time_ms_to_activate: 10,
min_calibrated_block_gas_limit: 2000,
}),
pipeline_backpressure: vec![
PipelineBackpressureValues {
Expand Down
13 changes: 5 additions & 8 deletions consensus/src/liveness/proposal_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,11 @@ impl PipelineBackpressureConfig {
.sorted()
.collect::<Vec<_>>();
if computed_target_block_gas_limits.len() >= config.min_blocks_to_activate {
let computed_target_block_gas_limit = (*computed_target_block_gas_limits
.get(
((config.percentile * computed_target_block_gas_limits.len() as f64)
as usize)
.min(computed_target_block_gas_limits.len() - 1),
)
.expect("guaranteed to be within vector size"))
.max(config.min_calibrated_block_gas_limit);
// TODO: this replaces percentile with mean
let sum: u64 = computed_target_block_gas_limits.iter().sum();
let average = (sum as f64 / computed_target_block_gas_limits.len() as f64) as u64;
let computed_target_block_gas_limit =
average.max(config.min_calibrated_block_gas_limit);
PROPOSER_ESTIMATED_CALIBRATED_BLOCK_TXNS
.observe(computed_target_block_gas_limit as f64);
// Check if calibrated block gas limit is a reduction, to turn on backpressure.
Expand Down

0 comments on commit 24e9448

Please sign in to comment.