perf_hooks: implement qrde analysis support in Histogram - #65806
Conversation
|
Review requested:
|
mcollina
left a comment
There was a problem hiding this comment.
RSLGTM
have you verified the algorithm against a reference implementation?
Is this such a complex computation that requires using the thread pool?
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #65806 +/- ##
==========================================
+ Coverage 90.14% 90.16% +0.02%
==========================================
Files 769 769
Lines 262968 263424 +456
Branches 50052 50140 +88
==========================================
+ Hits 237049 237515 +466
+ Misses 16924 16894 -30
- Partials 8995 9015 +20
🚀 New features to boost your workflow:
|
Yes! Verified everything against the equivalent Rscript implementation. There's even test for that with one of the fixtures.
It can be, yeah but it really depends on the size of data set. I was able to get the implementation pretty highly optimized but the calculation can range from tens to hundreds of milliseconds in common cases and I had one test case hit at ~1 second. While still way faster than the equivalent R implementation, given that these are better suited for post-collection analysis, making it async felt like the best option. That said, I was able to make major performance improvements in this over the original iteration and with the typical cases being in the 10s-100s ms range, we might be able to get away with making it fully sync. I'm still evaluating and running some more benchmarks today. |
Implements quantile-respectful density estimate calcuation on Histogram. Helps with tail-focused latency analysis without retaining raw samples. Baking this directly into Node.js, based on a 1 million sample, 1k bin workload, this impl is roughly 150-325x faster than performing the equivalent in Rscript. Signed-off-by: James M Snell <jasnell@gmail.com> Assisted-by: Opencode
26cb664 to
0a744b8
Compare
Continue expanding the built-in statistical analysis capabilities of
perf_hooksHistogram.Implements quantile-respectful density estimate (qrde) calculation on Histogram. Helps with tail-focused latency analysis without retaining raw samples. Think of it as a way of generating and exporting a compact analysis of the collected metrics without having to export the entire bucket. Very useful for generating plots of latency data.
Baking this directly into Node.js, based on a 1 million sample, 1k bin workload, this impl is roughly 150-325x faster than performing the equivalent in Rscript.
It's an async API because, while calculation should typically be quite fast for reasonably sized sample sets, the cost can compound as the number of buckets in the Histogram increases.
Example application that uses it: https://gist.github.com/jasnell/a5283d73b4ef6bb6e4e549bf15dc8f70