From d0df5dfe6e9e1d942dd1449853dc035bf5ff3e1c Mon Sep 17 00:00:00 2001 From: Lijun Wang <83639177+lijunwangs@users.noreply.github.com> Date: Sun, 17 Mar 2024 11:18:58 -0700 Subject: [PATCH 1/4] Show staked vs nonstaked packets sent down --- streamer/src/nonblocking/quic.rs | 13 +++++++++++++ streamer/src/quic.rs | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/streamer/src/nonblocking/quic.rs b/streamer/src/nonblocking/quic.rs index feb9bd2db65a3e..f9b9f16b8b2f82 100644 --- a/streamer/src/nonblocking/quic.rs +++ b/streamer/src/nonblocking/quic.rs @@ -963,6 +963,19 @@ async fn handle_chunk( .total_chunks_sent_for_batching .fetch_add(chunks_sent, Ordering::Relaxed); + match peer_type { + ConnectionPeerType::Unstaked => { + stats + .total_unstaked_packets_sent_for_batching + .fetch_add(1, Ordering::Relaxed); + } + ConnectionPeerType::Staked => { + stats + .total_staked_packets_sent_for_batching + .fetch_add(1, Ordering::Relaxed); + } + } + trace!("sent {} byte packet for batching", bytes_sent); } } else { diff --git a/streamer/src/quic.rs b/streamer/src/quic.rs index 3b1b6b21adf468..28472dc9dfd924 100644 --- a/streamer/src/quic.rs +++ b/streamer/src/quic.rs @@ -177,6 +177,8 @@ pub struct StreamStats { pub(crate) stream_load_capacity_overflow: AtomicUsize, pub(crate) process_sampled_packets_us_hist: Mutex, 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, } impl StreamStats { @@ -338,6 +340,18 @@ impl StreamStats { .swap(0, Ordering::Relaxed), i64 ), + ( + "staked_packets_sent_for_batching", + self.total_staked_packets_sent_for_batching + .swap(0, Ordering::Relaxed), + i64 + ), + ( + "unstaked_packets_sent_for_batching", + self.total_unstaked_packets_sent_for_batching + .swap(0, Ordering::Relaxed), + i64 + ), ( "bytes_sent_for_batching", self.total_bytes_sent_for_batching From 908ccadebd62ce77a12ee0833e2bf4c492dfbafc Mon Sep 17 00:00:00 2001 From: Lijun Wang <83639177+lijunwangs@users.noreply.github.com> Date: Fri, 5 Apr 2024 02:50:57 -0700 Subject: [PATCH 2/4] fixed comp issue --- streamer/src/nonblocking/quic.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/streamer/src/nonblocking/quic.rs b/streamer/src/nonblocking/quic.rs index f9b9f16b8b2f82..55c16e043121af 100644 --- a/streamer/src/nonblocking/quic.rs +++ b/streamer/src/nonblocking/quic.rs @@ -969,7 +969,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); From 582c597e71c1a8adc2bd8bbda22f15d73c3ae2e7 Mon Sep 17 00:00:00 2001 From: Lijun Wang <83639177+lijunwangs@users.noreply.github.com> Date: Sun, 17 Mar 2024 11:26:53 -0700 Subject: [PATCH 3/4] add metrics on throttled staked vs non-staked --- streamer/src/nonblocking/quic.rs | 12 ++++++++++++ streamer/src/quic.rs | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/streamer/src/nonblocking/quic.rs b/streamer/src/nonblocking/quic.rs index 55c16e043121af..ccd6f8a7b46fd4 100644 --- a/streamer/src/nonblocking/quic.rs +++ b/streamer/src/nonblocking/quic.rs @@ -795,6 +795,18 @@ async fn handle_connection( >= max_streams_per_throttling_interval { stats.throttled_streams.fetch_add(1, Ordering::Relaxed); + match params.peer_type { + ConnectionPeerType::Unstaked => { + stats + .throttled_unstaked_streams + .fetch_add(1, Ordering::Relaxed); + } + ConnectionPeerType::Staked(_) => { + stats + .throttled_staked_streams + .fetch_add(1, Ordering::Relaxed); + } + } let _ = stream.stop(VarInt::from_u32(STREAM_STOP_CODE_THROTTLING)); continue; } diff --git a/streamer/src/quic.rs b/streamer/src/quic.rs index 28472dc9dfd924..9ef2c360c92382 100644 --- a/streamer/src/quic.rs +++ b/streamer/src/quic.rs @@ -179,6 +179,8 @@ pub struct StreamStats { 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 { @@ -434,6 +436,7 @@ impl StreamStats { i64 ), ( + "stream_load_ema", self.stream_load_ema.load(Ordering::Relaxed), i64 @@ -448,6 +451,16 @@ 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 From 7a00f1549e9870b806663c2e28aa551eaf955426 Mon Sep 17 00:00:00 2001 From: Lijun Wang <83639177+lijunwangs@users.noreply.github.com> Date: Fri, 5 Apr 2024 11:09:16 -0700 Subject: [PATCH 4/4] fmt code --- streamer/src/quic.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/streamer/src/quic.rs b/streamer/src/quic.rs index 9ef2c360c92382..9b68ab1eea01ef 100644 --- a/streamer/src/quic.rs +++ b/streamer/src/quic.rs @@ -436,7 +436,6 @@ impl StreamStats { i64 ), ( - "stream_load_ema", self.stream_load_ema.load(Ordering::Relaxed), i64