From 1b38bed31f63001465d6d2bbef5b75e88bdd6a88 Mon Sep 17 00:00:00 2001 From: Dmitry Adamushko Date: Fri, 16 Jan 2026 18:46:32 +0100 Subject: [PATCH] Increase the duration of the EMA smoothing window (STREAM_LOAD_EMA_INTERVAL_COUNT) (#10033) streamer/TPU: increase STREAM_LOAD_EMA_INTERVAL_COUNT from 10 to 40 This constant controls the duration of the EMA smoothing window used to reduce sensitivity to short-lived load spikes at the start of a leader slot. Throttling is only triggered when saturation is sustained. The value 40 was chosen based on simulations: at a max target TPS of ~400K, it allows the system to absorb a burst of ~50K transactions over ~40 ms before throttling activates. There is no magic about N=40; the value should be tuned based on the size and duration of spikes we want to tolerate. (cherry picked from commit 51ebbc43a56a760a75aafdfa5512868b001d838c) # Conflicts: # streamer/src/nonblocking/stream_throttle.rs --- streamer/src/nonblocking/stream_throttle.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/streamer/src/nonblocking/stream_throttle.rs b/streamer/src/nonblocking/stream_throttle.rs index e773b5f816725c..03818e09460d5c 100644 --- a/streamer/src/nonblocking/stream_throttle.rs +++ b/streamer/src/nonblocking/stream_throttle.rs @@ -21,8 +21,19 @@ pub const STREAM_THROTTLING_INTERVAL_MS: u64 = 100; pub const STREAM_THROTTLING_INTERVAL: Duration = Duration::from_millis(STREAM_THROTTLING_INTERVAL_MS); const STREAM_LOAD_EMA_INTERVAL_MS: u64 = 5; +<<<<<<< HEAD const STREAM_LOAD_EMA_INTERVAL_COUNT: u64 = 10; const EMA_WINDOW_MS: u64 = STREAM_LOAD_EMA_INTERVAL_MS * STREAM_LOAD_EMA_INTERVAL_COUNT; +======= +// EMA smoothing window to reduce sensitivity to short-lived load spikes at the start +// of a leader slot. Throttling is only triggered when saturation is sustained. +// The value 40 was chosen based on simulations: at a max target TPS of ~400K, +// it allows the system to absorb a burst of ~50K transactions over ~40 ms +// before throttling activates. +const STREAM_LOAD_EMA_INTERVAL_COUNT: u64 = 40; + +const STAKED_THROTTLING_ON_LOAD_THRESHOLD_PERCENT: u64 = 95; +>>>>>>> 51ebbc43a (Increase the duration of the EMA smoothing window (STREAM_LOAD_EMA_INTERVAL_COUNT) (#10033)) pub(crate) struct StakedStreamLoadEMA { current_load_ema: AtomicU64,