Skip to content

stats: add EventBaseStatsCollector and wire into relay servers#295

Merged
afrind merged 1 commit intomainfrom
stats/evb-loop-observer
May 7, 2026
Merged

stats: add EventBaseStatsCollector and wire into relay servers#295
afrind merged 1 commit intomainfrom
stats/evb-loop-observer

Conversation

@afrind
Copy link
Copy Markdown
Contributor

@afrind afrind commented May 6, 2026

Add EventBaseStatsCollector which implements folly::EventBaseObserver to sample busy/idle loop times per IO thread. Wire it into MoqxRelayServer (one collector per evb worker) and MoqxPicoRelayServer (single evb). Add kEvbLoopBucketsUs and STATS_EVB_HISTOGRAM_FIELDS to the shared StatsRegistry.


This change is Reviewable

Base automatically changed from feat/picoquic-stat-histograms to main May 6, 2026 23:33
Copy link
Copy Markdown
Contributor

@gmarzot gmarzot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gmarzot reviewed 12 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on akash-a-n, michalhosna, mondain, Oxyd, peterchave, suhasHere, and TimEvens).

Add EventBaseStatsCollector which implements folly::EventBaseObserver to
sample busy/idle loop times per IO thread. Register one collector per evb
worker in MoqxRelayServer and one for the single evb in MoqxPicoRelayServer.
Add kEvbLoopBucketsUs and STATS_EVB_HISTOGRAM_FIELDS to StatsRegistry.

Wire loop observers into both QUIC collectors to populate
evbPktsSentPerLoop and evbPktsRecvPerLoop histograms from per-loop deltas.
StatsRegistry gains registerEvbCollector/findEvbCollector (backed by
EventBaseLocal) so QuicStatsCollector can look up the EVB collector lazily
on first callback.

PicoQuicStatsCollector: implement onPacketsSent/onPacketsReceived to
accumulate packet counts from socket-level drain callbacks rather than
PathQualityDelta.packetsSent (per-connection only, no recv equivalent).
Wire prevLoopPktsRecv_ so evbPktsRecvPerLoop is now populated for pico,
matching the mvfst collector.
@afrind afrind force-pushed the stats/evb-loop-observer branch from b7f9004 to 918c090 Compare May 7, 2026 22:44
Copy link
Copy Markdown
Contributor Author

@afrind afrind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@afrind made 1 comment.
Reviewable status: 6 of 13 files reviewed, 1 unresolved discussion (waiting on akash-a-n, gmarzot, michalhosna, mondain, Oxyd, peterchave, suhasHere, and TimEvens).


src/stats/EventBaseStatsCollector.h line 44 at r2 (raw file):

  // folly::EventBaseObserver — sample every loop iteration
  uint32_t getSampleRate() const override { return 1; }

Highlighting that we currently record the latency of every loop, which is needed to get the UDST for packets tx/rx per loop, which is key in performance tuning. I will file an issue for making the sample rate configurable.

@afrind afrind merged commit 1528cf4 into main May 7, 2026
11 of 12 checks passed
@afrind afrind deleted the stats/evb-loop-observer branch May 7, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants