Skip to content

MOD-18184 Gate benchmarks on committed KPI baselines - #1638

Merged
LiranAbir merged 6 commits into
masterfrom
MOD-18184-benchmark-baseline-gate
Sep 15, 2026
Merged

LiranAbir merged 6 commits into
masterfrom
MOD-18184-benchmark-baseline-gate

Conversation

@LiranAbir

@LiranAbir LiranAbir commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

MOD-18184 — follow-up to MOD-17912 (get_index regression), which we had no CI gate to catch.

What this does

Lets each tests/benchmarks/<test>.yml carry its own performance baseline as a redisbench-admin kpis floor:

kpis:
  - ge:
      "$.Tests.Overall.rps": 194750.47

No comparison code was needed — redisbench-admin already checks those floors at the end of every run (results_dict_kpi_check → return_code |= 1 → run_remote.py exit(return_code)). Verified against the installed package: a run above the floor returns 0, a run below returns 1.

That means every lane which already runs the benchmarks now gates on the baseline: the run-benchmark PR label, pushes to master / feature-* / X.Y, and the nightly.

Worth noting for reviewers: redisbench-admin compare, which this flow already ran, cannot serve as the gate — cli.py discards its return value, so it never fails a job regardless of how many regressions it prints.

Changes

  • benchmark-flow.yml — dropped continue-on-error: true from the run step. It was swallowing the exit code, which would have left the gate decorative. Added an upload of each group's result json files as a benchmark-results-<group> artifact (30 day retention).
  • event-nightly.yml — added the benchmark job, and wired it into test-summary's needs and job-failures string so a red baseline gate is named in the Slack summary instead of being visible only by drilling into the Actions run. (memory-nightly-report has the same gap today; left alone as out of scope.)
  • tests/benchmarks/update_kpis.py — new. Reads the result json files a run leaves behind and raises each floor to measured * (1 - margin) (5% default). It can only raise: a slower run proposes nothing, so a baseline cannot drift downwards on its own, and lowering one is always a hand edit in a reviewed PR. --self-test covers raise / never-lower / no-duplicate-block.
  • tests/benchmarks/Readme.md — documents the floors and the promotion flow.

Baseline promotion

Baselines are never written by CI. A faster-than-baseline nightly is picked up by the nightly analysis, which runs update_kpis.py against that run's own numbers and opens a PR with the raised floors. A human merges it; leaving it unmerged keeps the current baselines.

Not in this PR

Floors are intentionally not seeded — that needs measured values from a real run, and inventing numbers would give a meaningless gate. Until the first seeding PR merges, the gate is inert but harmless. The 5% margin is a starting point borrowed from redisbench-admin compare's own regression waterline; it should be revisited against the real run-to-run spread on the CI benchmarks dashboard once floors exist.

Risk

Dropping continue-on-error also means remote EC2/provisioning flake now reddens the job rather than passing silently. That is the intent of a gate, but it is a visible behavior change on three lanes.

🤖 Generated with Claude Code


Note

Medium Risk
Benchmark jobs can now fail merges and nightlies on KPI breaches or EC2 flakes; nightly Slack will report benchmark failures, and the known MOD-18654 benchmark may mask regression signal in job status alone.

Overview
Enforces committed benchmark KPI floors in CI by letting redisbench-admin run-remote fail the workflow when throughput drops below each test’s kpis floor, instead of swallowing errors with continue-on-error.

In benchmark-flow.yml, remote runs now fail the job on KPI breach; benchmark result JSON is uploaded as artifacts (for baseline bumps); and the PR performance comment runs with always() so it still posts when the run step fails. benchmark-runner.yml sets matrix fail-fast: false so one shard’s failure does not cancel the rest of the suite.

Nightly (event-nightly.yml) adds a benchmark job (skipped on push to avoid duplicate EC2 runs) and includes benchmark failures in the Slack test-summary job-failures string.

Adds tests/benchmarks/update_kpis.py to raise YAML floors from result JSON (measured × (1 − margin), never lowering) and replaces Readme.md with README.md documenting baselines, promotion flow, and that json_nummultby_num_2 (MOD-18654) keeps the job red until fixed—regressions vs that error must be read from logs.

Reviewed by Cursor Bugbot for commit c669f88. Bugbot is set up for automated code reviews on this repo. Configure here.

Each tests/benchmarks/<test>.yml can now carry its performance baseline as a
redisbench-admin `kpis` floor:

    kpis:
      - ge:
          "$.Tests.Overall.rps": 194750.47

redisbench-admin already checks those floors at the end of every run
(results_dict_kpi_check -> non-zero exit), so no separate comparison step is
needed -- every lane that runs the benchmarks gates on them: the
`run-benchmark` PR label, pushes to master/feature-*/X.Y, and the nightly.
(`redisbench-admin compare`, which the flow already ran, cannot serve as the
gate: cli.py discards its return value, so it never fails a job.)

The run step in benchmark-flow.yml dropped `continue-on-error: true`; it was
swallowing the exit code, which would have made the gate decorative. Note this
also means remote provisioning failures now fail the job rather than passing
silently.

Baselines are never written by CI. Each group uploads its result json files as
a benchmark-results-<group> artifact, and raising a floor is proposed out of
band from the nightly analysis: update_kpis.py applied to a faster run's own
numbers, opened as a PR for review. The script can only raise a floor, to
measured * (1 - margin), so a slower run proposes nothing (it has already
failed) and a baseline cannot drift downwards on its own -- lowering one is
always a hand edit in a reviewed PR.

The benchmark job is also added to the nightly, including its test-summary
needs and job-failures string, so a red baseline gate is named in the Slack
summary instead of being visible only by drilling into the Actions run.

Floors are intentionally not seeded here -- that needs measured values from a
real run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Sep 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.97%. Comparing base (1c74f65) to head (c669f88).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1638   +/-   ##
=======================================
  Coverage   85.97%   85.97%           
=======================================
  Files          15       15           
  Lines        5306     5306           
=======================================
  Hits         4562     4562           
  Misses        744      744           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread .github/workflows/benchmark-flow.yml Resolved
Comment thread .github/workflows/event-nightly.yml Resolved
A first seeding run against real results showed two problems.

One of the 43 benchmarks (json_recursive_descent_with_filter_uid_issue674)
uses memtier_benchmark rather than redis-benchmark, so its result json carries
the throughput under "ALL STATS".Totals."Ops/sec" instead of
Tests.Overall.rps. Both paths are already among the comparison metrics in
defaults.yml; the script now probes for either and writes the floor under
whichever one the result actually carries. The memtier jsonpath contains double
quotes, so its YAML key is single-quoted.

A result file it could not read a throughput from also aborted the whole run
part-way through, leaving some baselines seeded and the rest untouched. Such a
result is now reported and skipped, with a non-zero exit at the end, so a gap
is visible rather than silently mistaken for a baseline that was already high
enough. A benchmark the run simply did not cover stays silent, as before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread .github/workflows/benchmark-flow.yml Resolved
Comment thread .github/workflows/benchmark-flow.yml Resolved
redis-benchmark exits 1 on this test with only a CSV header and a zero second
duration, and has done since at least the 2026-08-09 master run -- silently,
because this step carried continue-on-error: true until this branch removed it.

Left in, it would redden every benchmark run, which defeats the point of the
gate: a real regression elsewhere would be indistinguishable from this standing
failure. run-remote filters on the yml filename, so a negative lookahead drops
just this one and keeps the other 42.

The underlying failure is untouched and still needs its own fix; while excluded
the test produces no data at all, so it is noted in tests/benchmarks/Readme.md
rather than left to rot unnoticed a second time.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread tests/benchmarks/update_kpis.py Resolved
Comment thread .github/workflows/benchmark-flow.yml Resolved
Removing continue-on-error made the run step's failure real, which had three
knock-on effects the original commit missed:

- The matrix in benchmark-runner.yml used the default fail-fast: true, so one
  group failing its KPI floor would cancel the other two and lose their results.
  Both matrices now set fail-fast: false; the gate is per-benchmark, so the
  other groups' numbers are still wanted. (Run 34947609292 got away with this
  only because groups 1 and 3 had already finished when group 2 failed.)
- `Generate Pull Request Performance info` keyed on a bare
  `github.event.number`, which GitHub implicitly treats as
  `success() && ...` -- so the comparison comment was skipped exactly on the
  PRs that breached a floor. Now `always() && github.event.number`.
- The result artifact was named per member id only, but the profiler matrix
  reuses ids 1-3 in the same run and upload-artifact@v4 requires unique names,
  so a run_profiler dispatch would fail the upload. triggering_env now
  disambiguates.

Two further fixes:

- The nightly benchmark job ran on every trigger including push, duplicating
  what event-push-to-integ.yml already does on the same pushes -- six EC2
  instances instead of three, with test-summary skipped on push so the extra
  run reported nowhere. Restricted to non-push events.
- update_kpis.py matched results with '*-<name>-*.json', but the filename joins
  branch and test name with the same separator, so a branch containing a
  benchmark name could bind the wrong result. The deployment type always
  follows the test name and always starts "oss-", so the pattern requires that
  too. Re-verified against all 42 real result files: same floors as before.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread .github/workflows/benchmark-flow.yml Resolved
…status

Reverts the --test-regex exclusion. The standing failure (MOD-18654) is
accepted, so the test keeps running and the benchmark job is simply red on
every run until it is fixed.

The consequence is that job status no longer distinguishes a breached
performance baseline from that known failure, so the distinction moves to the
log:

  "Condition on <metric> <measured> ge <floor> is False"  -> regression
  "Failed to run remote benchmark for test '...'"         -> MOD-18654

This does not weaken data collection: run-remote gets no --fail_fast and the
runner matrix is fail-fast: false, so all 42 other benchmarks still run, still
report, and still upload their results from a red run. json_nummultby_num_2 has
no floor of its own, so it cannot trigger a false regression either.

Documented in tests/benchmarks/Readme.md and in the analyze-nightly Phase 2C
workflow, where the baseline-bump step now keys off "no floor breached in the
log" rather than "job green" -- which would otherwise never be reached.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Comment thread tests/benchmarks/README.md Resolved

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 8acd225. Configure here.

Comment thread .github/workflows/benchmark-flow.yml Resolved
Both from @AvivDavid23's review on #1638. The repo already uses
actions/upload-artifact@v6 in six other places; the new upload step was the odd
@v4 out. The benchmarks doc is renamed with git mv so history follows, and the
reference to it in event-nightly.yml is updated.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@LiranAbir
LiranAbir merged commit 3df7e2b into master Sep 15, 2026
56 of 62 checks passed
@LiranAbir
LiranAbir deleted the MOD-18184-benchmark-baseline-gate branch September 15, 2026 12:33
LiranAbir added a commit that referenced this pull request Sep 27, 2026
Ten nights of nightlies (09-17 to 09-26) span two commits and produced
breach counts of 1, 0, 8, 0, 12, 4, 3, 9, 1, 15 -- a different set of
benchmarks each night, one of them swinging 38% between consecutive
runs, and a three-night dip that recovered fully on its own. A red
benchmark job therefore carries no information about RedisJSON, and the
floors are not the cause either: nothing seeded below ~46k rps has
breached on any of the ten nights, while everything above ~95k has.

So the lane is set aside until the harness's run-to-run variance is
understood (MOD-18823), rather than kept red nightly or worked around by
lowering floors -- the latter was proposed and closed Won't Do on
MOD-18888 after two more nights exceeded three of the four floors it
wanted to lower.

Scope is exactly what MOD-18184 added in #1638: the nightly job. The
push-to-integ, weekly and run-benchmark-label lanes date from 2023 and
are untouched, so benchmarks can still be run on demand and the
RedisTimeSeries/Grafana series keeps filling from the push lane.

The job is left wired into test-summary's `needs` and `job-failures`: a
skipped job resolves immediately and reports `skipped` rather than
`failure`, so the nightly summary is unaffected and re-enabling is one
line.
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