Skip to content

Speed up Codecov CI ~38% with parallel surefire forks#17697

Merged
JackieTien97 merged 2 commits into
masterfrom
worktree-codecov-ci-opt
May 17, 2026
Merged

Speed up Codecov CI ~38% with parallel surefire forks#17697
JackieTien97 merged 2 commits into
masterfrom
worktree-codecov-ci-opt

Conversation

@JackieTien97
Copy link
Copy Markdown
Contributor

@JackieTien97 JackieTien97 commented May 17, 2026

Summary

The codecov job in the Sonar-Codecov workflow currently runs ~66 minutes, of which ~51 minutes is the DataNode unit tests. Two factors stack to make these tests fully serial:

  • iotdb-core/datanode/pom.xml sets <reuseForks>false</reuseForks> (fresh JVM per test class).
  • Surefire's default forkCount=1 is never overridden, so only one JVM exists at a time.

On a 4-vCPU ubuntu-latest runner this means at most one test class runs at any moment, paying full JVM startup + JaCoCo instrumentation per class.

The parent pom.xml already sets <workingDirectory>${project.build.directory}/fork_${surefire.forkNumber}</workingDirectory>, so per-fork filesystem isolation is configured but unused. This PR passes -DforkCount=4 to the codecov mvn invocation so four test JVMs run in parallel.

Measured impact (this PR's draft runs)

Phase Baseline forkCount=2 forkCount=4
DataNode UTs 51 min 34 min 32 min
ConfigNode UTs 6 min 4 min 3 min
Consensus UTs 4 min 2 min 2 min
Job total 66 min 45 min 41 min

Net: 66 → 41 min (–38%). forkCount=4 saturates the 4-vCPU runner; the floor is now set by the long-tail tests (slowest single class is 127s).

Memory budget on the 16 GB runner: 4 × 1024m heap + maven + jacoco ≈ 5 GB, well within limits.

Test plan

  • CI green on draft PR with forkCount=2
  • CI green on draft PR with forkCount=4
  • Codecov job wall time drops materially
  • Coverage report uploads to Codecov
  • No new test failures introduced by parallel forks

The codecov job currently runs ~66 min, ~51 min of which is the DataNode
unit tests on a single JVM at a time. The datanode pom sets
reuseForks=false (fresh JVM per test class) and surefire defaults to
forkCount=1, so on the 4-core runner only one test class runs at any
moment. The parent pom already configures per-fork working directories
(fork_${surefire.forkNumber}), so the project is plumbed for parallel
forks but never enables them.

Pass -DforkCount=2 to the codecov maven invocation so two test JVMs run
in parallel, cutting the DataNode UT phase roughly in half without
changing test isolation semantics.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 40.40%. Comparing base (9330c7f) to head (3ffdfc0).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #17697      +/-   ##
============================================
+ Coverage     40.38%   40.40%   +0.01%     
- Complexity     2574     2575       +1     
============================================
  Files          5179     5179              
  Lines        349628   349628              
  Branches      44683    44683              
============================================
+ Hits         141206   141253      +47     
+ Misses       208422   208375      -47     

☔ View full report in Codecov by Sentry.
📢 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.

@sonarqubecloud
Copy link
Copy Markdown

@JackieTien97 JackieTien97 changed the title Speed up Codecov CI by running surefire with 2 parallel forks Speed up Codecov CI ~38% with parallel surefire forks May 17, 2026
@JackieTien97 JackieTien97 marked this pull request as ready for review May 17, 2026 10:12
@JackieTien97 JackieTien97 merged commit 754e500 into master May 17, 2026
43 of 44 checks passed
@JackieTien97 JackieTien97 deleted the worktree-codecov-ci-opt branch May 17, 2026 10:15
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