Skip to content

Run setup-heavy test suites in fewer shards - #13409

Open
PabloRzBo wants to merge 2 commits into
masterfrom
pablo/sdct-1444-fewer-smoke-shards
Open

PabloRzBo wants to merge 2 commits into
masterfrom
pablo/sdct-1444-fewer-smoke-shards

Conversation

@PabloRzBo

@PabloRzBo PabloRzBo commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

Halves the number of shards per JVM for the test suites whose jobs are mostly setup:

  • test_smoke, test_ssi_smoke and their arm64 variants: 4 shards instead of 8.
  • test_base and test_base_arm64: 2 shards instead of 4.

Every test still runs exactly once, in half as many jobs. Nothing else changes: same JVMs, same tasks, same rules for when the jobs run.

Why the pipeline doesn't get slower: a pipeline ends when its slowest job ends, and that is almost always a test_inst shard. Merged shards run about twice as many tests but still finish before it:

  • test_base was the slowest job in 9 of 372 cases in PR pipelines (6 days). Merged shards take about 11 min on PRs and 17 min on master, against 20–48 min for the slowest test_inst shard.
  • test_smoke was the slowest job in 85 of 372 cases (about 23%). Merged shards take 18.8 min at the PR median (16.3 today), still under the slowest test_inst shard (20.4 min median). In the pipelines where smoke was already last, the pipeline can get up to about 2.5 min longer (see Trade-offs).
  • Measured on branches with every test running: 56 min pipeline in both the control and this change.

Motivation

Cut CI runner cost without losing coverage or gating.

  • Each of these jobs spends about 7–9 minutes on fixed setup before and after its tests (test_base about 7, smoke 8–9): pod start, clone, cache restore, Gradle configuration and report upload. That's about half of their runner time or more (GitLab runner metrics and job logs, 2026-11-07 to 11-12).
  • Each removed shard saves one job's setup and runs the same tests in the job it merged into.
  • Smoke tests partly rerun even with a warm build cache, because the agent jar they test changes on every commit.

Estimate, not measured after merge: about 4.3k runner-hours over 5.25 days (about 23k per 28 days), or 14% of GitLab main-pipeline runner time.

Additional Notes

Experiments

Branch pipelines on DDCI, each change against a control branch on the same base. The build cache was isolated per pipeline so every test really ran. JVMs 8, 17 and 21, one run per arm. Two control runs differed by about 3% in runner-hours.

Control This change
Pipeline runner-hours 29.3 26.4 (−9.9%)
Executed jobs 129 111
test_smoke: jobs, runner-hours, slowest shard 24, 5.5 h, 19.6 min 12, 3.5 h, 21.1 min
test_base: jobs, runner-hours, slowest shard 12, 2.0 h, 13.0 min 6, 1.3 h, 13.8 min
Pipeline duration 56 min 56 min

A second, independent experiment (cache-warm, all JVMs, two rounds) measured the test_base half alone: 179 → 106 and 189 → 113 job-minutes per pipeline.

Tests that it works as expected

  • The same tests run.
    • aggregate_test_counts matched the control: 252,568 tests, plus 4–7 entries from flaky tests retried inside jobs. In the second experiment, counts matched per job family and JVM in both rounds.
    • Projects are assigned to shards by abs(path.hashCode() % slots) + 1 (CIJobsExtensions.kt). With half the slots, new shard k holds exactly the projects of old shards k and k + 4 (smoke) or k + 2 (base), so nothing is dropped or run twice.
  • The CI config resolves as intended. CI lint dry run of this branch's YAML (2026-11-13): master 739 → 559 jobs and merge queue 713 → 533 (smoke −144, base −36 in both).
  • Shards stay well under the 1-hour job timeout.
    • Measured: slowest smoke shard 21.1 min, slowest base shard 13.8 min.
    • Modelled from master job durations: slowest master shard about 25 min (smoke) and 17 min (base).
  • Review: the code-review agent approved the smoke commit (1 round, no findings) and, in a separate session, the base commit.

Trade-offs and limits

  • PR pipelines whose slowest job is a smoke shard get up to about 2.5 min longer (modelled; slowest smoke shard 16.3 → 18.8 min median on PRs).
  • A hung test now fails a job holding twice as many tests, and a retry reruns twice as many tests.
  • If Balance instrumentation test shards by splitting long test task chains #13344 (rebalanced test_inst shards) is merged, test_inst gets shorter and smoke shards are more likely to become the slowest job in PR pipelines (today: 23% of cases, 18.8 vs 20.4 min at the PR median). One week after this PR is merged, check how often test_smoke is the slowest job and the PR pipeline p50; if smoke has become the bottleneck, use 6 smoke shards instead of 4.
  • Not exercised on branches: test_ssi_smoke (master and merge queue only) and the arm64 variants (manual on branches).
  • test.configuration.split in upload_ciapp.sh carries the job's position in the JVM × shard matrix, so these suites start new Test Optimization configuration values. Left as is on purpose; every matrix change already does this.

Jira ticket: SDCT-1444

🤖 Generated with Claude Code

Per-job setup is a large share of each smoke shard. Halving the shards of test_smoke, test_ssi_smoke and their arm64 variants removes 144 jobs from each master and merge queue pipeline; the same tests still run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PabloRzBo PabloRzBo added tag: no release notes Changes to exclude from release notes type: refactoring comp: tooling Build & Tooling tag: ai generated Largely based on code generated by an AI or LLM labels Nov 12, 2026
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 59.76% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0246294 | Docs | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.02 s 13.99 s [-0.7%; +1.2%] (no difference)
startup:insecure-bank:tracing:Agent 12.94 s 13.01 s [-1.5%; +0.3%] (no difference)
startup:petclinic:appsec:Agent 17.27 s 17.17 s [-0.4%; +1.6%] (no difference)
startup:petclinic:iast:Agent 17.13 s 17.13 s [-0.8%; +0.8%] (no difference)
startup:petclinic:profiling:Agent 16.79 s 16.92 s [-2.0%; +0.5%] (no difference)
startup:petclinic:sca:Agent 17.23 s 17.05 s [+0.1%; +2.0%] (maybe worse)
startup:petclinic:tracing:Agent 16.13 s 16.27 s [-1.7%; +0.0%] (no difference)

Commit: 02462942 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

Like the smoke suites, test_base and test_base_arm64 jobs spend a large share of their time on setup. Halving their shards removes 36 jobs from each master and merge queue pipeline; the same tests still run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@PabloRzBo PabloRzBo changed the title Run smoke tests in 4 shards instead of 8 Run setup-heavy test suites in fewer shards Nov 13, 2026
@PabloRzBo
PabloRzBo marked this pull request as ready for review November 13, 2026 13:37
@PabloRzBo
PabloRzBo requested review from a team as code owners November 13, 2026 13:37
@PabloRzBo
PabloRzBo requested review from bric3, mhlidd and randomanderson and removed request for a team November 13, 2026 13:37
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T13:40:01.471717Z 0246294 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: PASS

More details

The reduced shard matrices preserve JVM coverage and exhaustive test assignment. Pipeline duration and cost estimates were not independently validated.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 0246294

@bric3

bric3 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

This PR reduces the slots, but I'm not sure it's the right approach. I believe it is ok only because the S3 Build Cache is working, but when the cached entries cannot be reused then the full suites have to run, and the lower slot numbers will make those even worse.

A second, independent experiment (cache-warm, all JVMs, two rounds)

Imho, the tests should be conducted with a cold cache, which let me to think we need to look into changing the SKIP_BUILD_CACHE as a "cache mode" or "cache scope".

WDYT @AlexeyKuznetsov-DD @sarahchen6

@AlexeyKuznetsov-DD

Copy link
Copy Markdown
Contributor

This PR reduces the slots, but I'm not sure it's the right approach. I believe it is ok only because the S3 Build Cache is working, but when the cached entries cannot be reused then the full suites have to run, and the lower slot numbers will make those even worse.

A second, independent experiment (cache-warm, all JVMs, two rounds)

Imho, the tests should be conducted with a cold cache, which let me to think we need to look into changing the SKIP_BUILD_CACHE as a "cache mode" or "cache scope".

WDYT @AlexeyKuznetsov-DD @sarahchen6

Yes, I have the same feeling. Also we keep running ALL tests on master for a purpose to collect signals about flaky tests, so having less slots and without S3 cache we can easily get slot that will rung longer than 1h (our hard limit) and it will affect our Green CI score that we calculate on master branch.

@sarahchen6

Copy link
Copy Markdown
Contributor

If tested with a cold cache, all tests running, and no timeouts, I think this should be worth considering! Seems like an easy win (a few test jobs slow by some minutes but not enough to affect the entire pipeline duration), barring no loss of coverage.

@mhlidd
mhlidd removed their request for review November 18, 2026 14:24

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: tooling Build & Tooling tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants