Skip to content

Commit

Permalink
Show staked vs nonstaked packets sent down/throttled (solana-labs#600)
Browse files Browse the repository at this point in the history
* Show staked vs nonstaked packets sent down

* add metrics on throttled staked vs non-staked
  • Loading branch information
lijunwangs committed Apr 18, 2024
1 parent 068b6d5 commit d2512c9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
6 changes: 3 additions & 3 deletions streamer/src/nonblocking/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,13 +763,13 @@ async fn handle_connection(
>= max_streams_per_throttling_interval
{
stats.throttled_streams.fetch_add(1, Ordering::Relaxed);
match peer_type {
match params.peer_type {
ConnectionPeerType::Unstaked => {
stats
.throttled_unstaked_streams
.fetch_add(1, Ordering::Relaxed);
}
ConnectionPeerType::Staked => {
ConnectionPeerType::Staked(_) => {
stats
.throttled_staked_streams
.fetch_add(1, Ordering::Relaxed);
Expand Down Expand Up @@ -953,7 +953,7 @@ async fn handle_chunk(
.total_unstaked_packets_sent_for_batching
.fetch_add(1, Ordering::Relaxed);
}
ConnectionPeerType::Staked => {
ConnectionPeerType::Staked(_) => {
stats
.total_staked_packets_sent_for_batching
.fetch_add(1, Ordering::Relaxed);
Expand Down
48 changes: 48 additions & 0 deletions streamer/src/quic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ pub struct StreamStats {
pub(crate) stream_load_ema: AtomicUsize,
pub(crate) stream_load_ema_overflow: AtomicUsize,
pub(crate) stream_load_capacity_overflow: AtomicUsize,
pub(crate) process_sampled_packets_us_hist: Mutex<histogram::Histogram>,
pub(crate) perf_track_overhead_us: AtomicU64,
pub(crate) total_staked_packets_sent_for_batching: AtomicUsize,
pub(crate) total_unstaked_packets_sent_for_batching: AtomicUsize,
pub(crate) throttled_staked_streams: AtomicUsize,
pub(crate) throttled_unstaked_streams: AtomicUsize,
}

impl StreamStats {
Expand Down Expand Up @@ -436,6 +442,48 @@ impl StreamStats {
self.stream_load_capacity_overflow.load(Ordering::Relaxed),
i64
),
(
"throttled_unstaked_streams",
self.throttled_unstaked_streams.swap(0, Ordering::Relaxed),
i64
),
(
"throttled_staked_streams",
self.throttled_staked_streams.swap(0, Ordering::Relaxed),
i64
),
(
"process_sampled_packets_us_90pct",
process_sampled_packets_us_hist
.percentile(90.0)
.unwrap_or(0),
i64
),
(
"process_sampled_packets_us_min",
process_sampled_packets_us_hist.minimum().unwrap_or(0),
i64
),
(
"process_sampled_packets_us_max",
process_sampled_packets_us_hist.maximum().unwrap_or(0),
i64
),
(
"process_sampled_packets_us_mean",
process_sampled_packets_us_hist.mean().unwrap_or(0),
i64
),
(
"process_sampled_packets_count",
process_sampled_packets_us_hist.entries(),
i64
),
(
"perf_track_overhead_us",
self.perf_track_overhead_us.swap(0, Ordering::Relaxed),
i64
),
);
}
}
Expand Down

0 comments on commit d2512c9

Please sign in to comment.