Add memory benchmark CI workflow#1937
Conversation
Signed-off-by: doxxx93 <doxxx93@gmail.com>
…tion Signed-off-by: doxxx93 <doxxx93@gmail.com>
Signed-off-by: doxxx93 <doxxx93@gmail.com>
…rk results Signed-off-by: doxxx93 <doxxx93@gmail.com>
Signed-off-by: doxxx93 <doxxx93@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1937 +/- ##
=======================================
+ Coverage 76.2% 76.2% +0.1%
=======================================
Files 89 89
Lines 8487 8487
=======================================
+ Hits 6464 6466 +2
+ Misses 2023 2021 -2 🚀 New features to boost your workflow:
|
d0d3427 to
80a862e
Compare
Signed-off-by: doxxx93 <doxxx93@gmail.com>
…nd pull request Signed-off-by: doxxx93 <doxxx93@gmail.com>
|
@clux I took a stab at the full CI integration for the memory benchmarks from #1505. Would love your thoughts on a few things: What's implemented:
Feedback I'd appreciate:
|
|
hey. awesome work. finally gotten to have a look at this. i think the general setup looks sensible. i'll put some nits on the actual code, but here's some quick comments on your points:
|
…edback - Switch PR comparison from actions/cache to gh-pages branch - Add permissions (contents: write, pull-requests: write) for alert comments and gh-pages auto-push - Lower alert threshold to 110% - Restrict to github.repository == 'kube-rs/kube' Signed-off-by: doxxx <doxxx93@gmail.com>
1ceeead to
0a0d80f
Compare
Changes after review
ValidationTested the full pipeline in doxxx93/memory-bench-test (minimal dhat benchmark, same workflow structure):
https://doxxx93.github.io/memory-bench-test/bench/ you can watch the benchmark page Questions
|
|
I think both values are good personally.
This all looks very sensible to me. The only thing that stood out to me is how blindingly white the page is, but looks like that looks non-trivial to customize. I see they have some issues on ui redesign and dark mode also so maybe it gets more visually pleasing eventually. Anyway, happy to merge if you are happy with it! |
|
Yeah, the page is quite bright 😄 I think we can gradually improve the UI over time — I'm happy to merge now currently :) |
|
By the way — I do have merge permissions, but I've been holding off on using them so far. For example, I approved #1939 but left the merge to you. Would it be okay for me to start merging PRs like these myself, or would you prefer to keep handling that? |
nonono, of course go ahead. you have access, and i'd appreciate it. it's usually easier to keep |
|
@clux The benchmark data is being pushed to gh-pages branch successfully, but GitHub Pages isn't enabled on the repo yet, so https://kube-rs.github.io/kube/bench/ returns 404. Could you enable GitHub Pages in repo Settings (Source: Deploy from branch, Branch: gh-pages / / (root))? hmm, I think it's not necessary. |
|
nice. i've added those options for now. these links seems to work:
|
|
looks great! Looking forward to seeing the trends build up with more commits. Aggregating the 3 metrics per scenario (instead of 15 separate charts) could make it easier to scan, also other ui things :) let's fix it later |
|
yeah, agreed. but at least the data is there. the big value is probably going to be the warnings on exceeding thresholds. we'll see how difficult it is to backtrack to future regressions (guessing each dot will represent a squash merge into |
|
The first PR (#1942) has been merged since this was set up, and the benchmark dashboard at https://kube-rs.github.io/kube/bench/ is working as expected — two data points are now showing with stable memory metrics across all 15 benchmarks. Looks good! 🎉 |

Closes #1505
Motivation
Ref #1505 — maintainer requested automatic detection of memory profile regressions in PRs. The benchmark code (
kube-runtime/benches/memory.rs) was already implemented; this PR adds CI integration to run it automatically and report results.Solution
kube-runtime/benches/memory.rs: OutputcustomSmallerIsBetterJSON directly (viaserde::Serialize), eliminating the need for shell-based output parsing in CI..github/workflows/memory-bench.yml: New workflow triggered onpull_requestthat:cargo bench -p kube-runtime --bench memorybenchmark-action/github-action-benchmark@v1Benchmark covers 5 scenarios (init_listwatch, steady_state, relist, init_without_modify, init_with_modify) × 3 metrics (peak_bytes, total_allocated, alloc_count) = 15 data points per run.