Skip to content

ci: parallelize benchmark tests across 3 runners#54

Merged
SebTardif merged 2 commits into
mainfrom
ci/parallel-benchmarks
May 26, 2026
Merged

ci: parallelize benchmark tests across 3 runners#54
SebTardif merged 2 commits into
mainfrom
ci/parallel-benchmarks

Conversation

@SebTardif

Copy link
Copy Markdown
Contributor

Split the single Benchmark Tests job into a matrix of 3 parallel jobs, one per package (controller, metrics, recommendation).

Before: 1 runner, ~10 min (all 20 benchmarks sequential)
After: 3 runners in parallel, wall-clock = max(heaviest shard)

Shard Package Benchmarks Expected weight
controller internal/controller/... 9 (incl. ManyWorkloads/ManyPolicies up to 1000) Heavy (~5-6 min)
metrics internal/metrics/... 4 Light (~2 min)
recommendation internal/recommendation/... 6 Medium (~3 min)

Each shard has its own baseline cache key (bench-baseline-<pkg>-...) for independent benchstat comparison. The first merge to main after this PR will establish per-package baselines.

ci-gate depends on test-bench, which with a matrix strategy already waits for all 3 shards to complete. No changes needed there.

SebTardif added 2 commits May 26, 2026 14:07
Split the single Benchmark Tests job into a matrix of 3 parallel jobs,
one per package (controller, metrics, recommendation). This reduces
wall-clock time from ~10 minutes (sum of all) to ~max(controller),
roughly a 2-3x speedup.

Each shard maintains its own baseline cache for benchstat comparison.

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
Further split the controller benchmark shard (8m41s) into two parallel
jobs using -bench regex filtering:

- controller-core: fast benchmarks (BuildPrometheusQuery, Reconcile,
  ComputeRecommendations) -- ~1 min expected
- controller-scale: scale benchmarks (ManyWorkloads, ManyPolicies,
  ConcurrentPolicies up to 1000) -- the heavy tail

Total shards: 4 (controller-core, controller-scale, metrics, recommendation)
Expected wall-clock: max(controller-scale) instead of sum(all).

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
@SebTardif SebTardif merged commit 7fdd44a into main May 26, 2026
29 checks passed
SebTardif added a commit that referenced this pull request May 26, 2026
Further split controller-scale (8m06s) into two parallel shards:
- controller-workloads: BenchmarkReconcile_ManyWorkloads
- controller-policies: BenchmarkReconcile_ManyPolicies + ConcurrentPolicies

Reduce max scale from {10,100,500,1000} to {10,50,100,250}.
250 catches the same O(n^2) regressions at 1/12th the cost of 1000
(1.6s vs 20s per iteration locally).

Total benchmark shards: 5 (was 4 after PR #54).

Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
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.

1 participant