Skip to content

[type:perf] Speed up CI preparation and parallelize test matrices - #8271

Merged
Aias00 merged 8 commits into
masterfrom
perf/github-actions
Nov 2, 2026
Merged

Aias00 merged 8 commits into
masterfrom
perf/github-actions

Conversation

@yuluo-yx

@yuluo-yx yuluo-yx commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Problem and behavior

Integration jobs spend most of their time preparing runners, dependencies and services. The initial gh sample of 50 apache/shenyu runs contained 239 jobs (190 successful, 33 skipped, 4 failed, 12 cancelled). Successful HTTP integration jobs spent a median 514.5 seconds preparing and 44.5 seconds in test/check steps; median runner queue time across successful jobs was only 2 seconds.

This change reduces preparation and parallelizes the existing test inventory. It does not change application code or test assertions.

Changes

  • Cancel superseded PR runs using cancel-in-progress. Give non-PR runs a unique run_id concurrency group so running and pending master commits cannot replace one another. Aggregate gates use !cancelled() while still checking dependency results; always() had kept an obsolete E2E run alive and delayed its successor by 308 seconds. Resource cleanup steps keep their cancellation handling.
  • Skip heavy jobs for documentation-only PRs while retaining stable checks. Use push path exclusions where safe. Fix the vendored path filter's predicate configuration so exclusions are combined with AND rather than OR. Wrapper, Maven configuration, workflow and helper changes still trigger validation. Required-check names and branch protection are unchanged.
  • Use setup-java's Maven cache instead of duplicate cache operations. Download the pinned prebuilt kind binary instead of compiling it with go install; use the Maven wrapper consistently. Clean runner disk only when needed and build only example modules/images deployed by each case, failing closed for unknown inputs. Do not add unrelated tool caches or delete shared remote caches.
  • Share one producer build for full PR/push reactors. Run 12 disjoint module shards per JDK, retaining Java 17 tests/coverage and Java 21 compatibility tests. Checkstyle remains in the full producer build. Keep independent correctness checks parallel and include them in the stable build gate. Package the shared Maven repository as one archive, avoid recompressing it during upload, and keep backups outside the cached repository. Upgrade Codecov to v5 with the existing token secret.
  • Split six E2E protocol/logging scenarios across all three existing sync channels, retaining two cluster and four storage scenarios: 24 workers in total. Replace fixed cluster startup sleeps with immediate health polling while preserving the full startup allowance. Manual scripts still run all channels by default. All five SQL dialects remain covered.
  • Add a reusable actions-timings.py exporter with per-job queue, runner queue, preparation and verification columns. Keep cancelled/failed/skipped observations separate from successful timing samples.

Measured results

All measurements below are from apache/shenyu. Workflow wall time includes scheduling and dependency waits. These are individual observations, not guaranteed speedups across runner/network variation.

Controlled original HTTP baseline versus optimized HTTP

The two runs use identical application/test sources and the same HTTP case. Each reports exactly 27 test-class result records and 103 tests, with zero failures/errors and the same 5 existing skips.

Measurement Original Optimized Change
Workflow wall time 589 s 428 s -27.3%
Preparation and teardown outside the JUnit window 544.088 s 384.968 s -29.2%
Actual JUnit execution window 30.912 s 31.032 s Essentially unchanged

Original: https://github.com/apache/shenyu/actions/runs/41317670168

Optimized: https://github.com/apache/shenyu/actions/runs/41318728663

The original control only adds a manual timing entry point to the upstream workflow. Preparation above is job runtime minus the first-to-last JUnit execution window; it excludes queue time. The exporter itself uses API step boundaries, so its verification column can also contain compilation or deployment performed inside a test step.

First complete optimization iteration versus final revision

The first iteration already contains preparation optimizations and is not an untouched upstream baseline.

Workflow First iteration Final revision Change
ci 709 s 483 s -31.9%
e2e 854 s 572 s -33.0%
it 558 s 606 s +8.6%
it-k8s 300 s 310 s +3.3%
it-k8s-gateway-api 271 s 275 s +1.5%
Longest workflow in the complete run set 854 s 606 s -29.0%

The final IT critical path is the combination case: 137 seconds building the main reactor and 264 seconds waiting for services, compared with 116 and 257 seconds in the first iteration. The higher IT time is retained in the comparison; there is no claim that every workflow became faster. Artifact upload in the CI producer decreased from 44 to 13 seconds in the measured intermediate iteration.

First iteration: CI, E2E, IT.

Latest revision 5b8f205aad9c9259e703665dc6f206ff5d34c209: all 11 workflows succeeded, with initial scheduling waits of 2-3 seconds. Latest PR checks report 91 passes and one expected skip; all required checks pass.

Final workflow Wall time Evidence
ci 483 s https://github.com/apache/shenyu/actions/runs/41326486295
e2e 572 s https://github.com/apache/shenyu/actions/runs/41326486354
it 606 s https://github.com/apache/shenyu/actions/runs/41326486308
it-k8s 310 s https://github.com/apache/shenyu/actions/runs/41326486258
it-k8s-gateway-api 275 s https://github.com/apache/shenyu/actions/runs/41326486266
k8s-examples-http 269 s https://github.com/apache/shenyu/actions/runs/41326486261
native-sql-matrix 168 s https://github.com/apache/shenyu/actions/runs/41326486273
minimal-http 140 s https://github.com/apache/shenyu/actions/runs/41326486281
wasm-fixtures 103 s https://github.com/apache/shenyu/actions/runs/41326486326
docker-image-smoke 48 s https://github.com/apache/shenyu/actions/runs/41326486240
CodeQL 499 s https://github.com/apache/shenyu/actions/runs/41326486250

Validation and coverage preservation

  • Compared every test-class result and test/failure/error/skip count between the first full CI run and the successful rebalanced shards: identical counters for both JDKs. Each JDK has 1,272 class/suite result records and 8,986 tests, zero failures/errors; existing skips remain 20 for Java 17 and 19 for Java 21. The final commit only changes cancellation of aggregate gates and the corresponding regression check.
  • node --test .github/scripts/test-ci-workflows.mjs: 28 checks pass, including documentation scope, shard coverage without duplicates, unchanged channel combinations, startup allowance and aggregate cancellation.
  • python3 -B .github/scripts/test-native-sql-matrix.py: 33 tests pass. New timing/example/repository Python regression tests: 16 pass. Standard-library trace line coverage is 97% for the timing exporter and 96% for the example resolver; this is not a whole-repository coverage claim.
  • Actionlint and ShellCheck pass for all changed workflows. Maven-wrapper Apache RAT passes. Existing case-routing, disk-cleanup, Maven-retry, k3s, E2E handoff/repository, retest and publish-routing helper checks pass.
  • Two consecutive local ./mvnw -B -ntp -pl shenyu-common -am package -DskipTests -Dmaven.javadoc.skip=true builds with Temurin 17 pass in 7.25 and 3.74 seconds; the second build does not recompile. These are incremental builds, not a cold-build benchmark.
  • Full reactors, test compilation and Java 17/21 execution pass on GitHub Ubuntu runners. A full local clean install was not run. Publishing was not triggered; publishing workflow edits were statically validated and the build/Docker smoke workflows passed.

No application migration is required. The workflow configuration replaces the existing configuration directly; reverting this PR restores the prior behavior. Shared remote caches were not deleted. Final validation: 2026-11-02 (Asia/Shanghai).

  • Read the contribution guidelines.
  • Add regression tests backing the workflow changes.
  • Run the full local clean install (affected-module package and RAT checks completed; full reactors pass in CI).

@yuluo-yx yuluo-yx changed the title [type:perf] Reduce CI preparation and shard full Maven test reactors [type:perf] Speed up CI preparation and parallelize test matrices Nov 1, 2026
@yuluo-yx
yuluo-yx marked this pull request as ready for review November 1, 2026 16:46
@Aias00
Aias00 merged commit af04ad4 into master Nov 2, 2026
92 checks passed
@yuluo-yx
yuluo-yx deleted the perf/github-actions branch November 4, 2026 15:13
@Aias00 Aias00 added this to the 2.7.2 milestone Nov 13, 2026
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