stats: add EventBaseStatsCollector and wire into relay servers#295
stats: add EventBaseStatsCollector and wire into relay servers#295
Conversation
gmarzot
left a comment
There was a problem hiding this comment.
@gmarzot reviewed 12 files and all commit messages.
Reviewable status: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.
b7f9004 to
918c090
Compare
afrind
left a comment
There was a problem hiding this comment.
@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.
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