Skip to content

Add sqlclient-perf-pr pipeline comparing against main branch source - #4519

Open
cheenamalhotra wants to merge 3 commits into
mainfrom
dev/cheena/turbo-journey
Open

Add sqlclient-perf-pr pipeline comparing against main branch source#4519
cheenamalhotra wants to merge 3 commits into
mainfrom
dev/cheena/turbo-journey

Conversation

@cheenamalhotra

@cheenamalhotra cheenamalhotra commented Aug 8, 2026

Copy link
Copy Markdown
Member

Summary

Introduces a PR-oriented variant of the perf pipeline: eng/pipelines/perf/sqlclient-perf-pr-pipeline.yml.

Pipeline in ADO: sqlclient-perf-pr
Purpose: To be used to run perf tests to capture benchmarks for PRs, personal braches, and publish comparison results locally against dotnet/sqlclient:main branch.

It extends the same v1/Perf.Test.Job.yml@PerfTemplates template and exposes the same configuration options as sqlclient-perf-pipeline.yml (platform, framework, run mode, confirmation runs, regression threshold/gate, managed SNI, optimized async behaviour, connection pool V2), but:

  • Runs on the branch the run is queued on — manual/queue-time only (pr: none, trigger: none).
  • Uses main branch source code as the baseline instead of a released NuGet package.
  • Does not ingest results into Kusto — no ADX variable group, no translate/publish/ingest steps.

Source baseline mechanism

The perf template only exposes post-test steps, so both benchmark passes must happen inside the on-VM script. The run scripts therefore gain a second, mutually-exclusive baseline selector:

Script New arguments
run-perf-tests.sh --baseline-source-ref, --baseline-repo-url
run-perf-tests.ps1 -BaselineSourceRef, -BaselineRepoUrl

When a source ref is given, the script materialises that ref outside the checkout (so it can never be picked up by the candidate build or the results copy-back):

  1. git fetch --no-tags --depth 1 origin '+refs/heads/<ref>:refs/remotes/perfbaseline/<ref>' + git worktree add --detach — uses the copied checkout's own origin.
  2. Falls back to git clone --quiet --depth 1 --branch <ref> <baselineRepoUrl> when the tree arrived without .git or origin needs credentials the VM lacks.

The baseline pass then builds that ref's own PerformanceTests project, whose default ProjectReference points at that ref's driver source. This keeps interleave_perf.py's --baseline-exe-dir / --current-exe-dir contract unchanged, and both passes still use the same injected RUNNER_CONFIG / DATATYPES_CONFIG so configuration is identical on both sides.

The comparison is labelled <ref>@<sha> (e.g. main@9b20e5ec3) so each run records exactly which baseline commit it measured against.

The existing package baseline (--baseline-version -> ReferenceType=Package + MdsPackageVersion) is unchanged; supplying both selectors fails fast.

Verification

  • bash -n on run-perf-tests.sh; PowerShell parser check on run-perf-tests.ps1
  • YAML parse of the new pipeline
  • Both git-acquisition paths smoke-tested (origin fetch and clone fallback), incl. a fix for .git being a file in a worktree
  • Out-of-tree baseline build: dotnet build of the perf project from a detached worktree into a separate output dir — 0 warnings, 0 errors, ~13s

Notes for reviewers

  • The new pipeline still needs to be registered in Azure DevOps pointing at eng/pipelines/perf/sqlclient-perf-pr-pipeline.yml.
  • End-to-end validation requires the Perf Test Lab VM; the first real run should exercise both the .git-present path and the GitHub clone fallback.
  • If a PR adds or removes benchmarks, compare_perf.py reports them as new / removed rather than failing.

Checklist

  • Tests added or updated — n/a (pipeline/infra change; scripts smoke-tested as above)
  • Public API changes documented — n/a, no public API change
  • Verified against customer repro (if applicable) — n/a
  • Ensure no breaking changes introduced — existing sqlclient-perf pipeline and its package-baseline path are unchanged
  • Documentation updated — eng/pipelines/perf/README.md covers both pipelines, the source-baseline mechanism, PR-only parameters, and new troubleshooting entries

Introduces eng/pipelines/perf/sqlclient-perf-pr-pipeline.yml, a PR-oriented
variant of the perf pipeline. It extends the same Perf.Test.Job.yml template and
exposes the same configuration options, but:

* runs against the branch the run is queued on (manual/queue-time only),
* uses the 'main' branch SOURCE as the baseline instead of a released package,
* does not ingest results into Kusto (no ADX variable group, no translate/
  publish/ingest steps).

To support this, the on-VM run scripts gain a second baseline selector:

* run-perf-tests.sh: --baseline-source-ref / --baseline-repo-url
* run-perf-tests.ps1: -BaselineSourceRef / -BaselineRepoUrl

The selector is mutually exclusive with the existing package baseline. The
baseline ref is materialised outside the checkout (git worktree from the
checkout's origin, falling back to a shallow clone) and that ref's own
PerformanceTests project is built, so the measured driver is the baseline
source. The comparison is labelled '<ref>@<sha>' so the exact baseline commit
is recorded.

README documents both pipelines, the source-baseline mechanism, the PR-only
parameters, and new troubleshooting entries.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 08b18803-3735-44b6-8afc-1996ef05fe15
Copilot AI lite review requested due to automatic review settings August 8, 2026 06:18
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board Aug 8, 2026
@cheenamalhotra cheenamalhotra added this to the 7.1.0-preview3 milestone Aug 8, 2026

Copilot AI 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.

Pull request overview

Adds a PR-oriented performance pipeline that runs the existing SqlClient perf benchmark suite against the queued branch (“current”) and compares it to a source baseline from another ref in this repo (default main), without ingesting results into Kusto. This fits into the existing eng/pipelines/perf/ perf automation by reusing the same Perf Test Lab extends template and the same on-VM run scripts.

Changes:

  • Introduces sqlclient-perf-pr-pipeline.yml, a manual-only perf pipeline variant using source-baseline comparison and publishing artifacts/summaries only (no Kusto).
  • Extends the on-VM run scripts (run-perf-tests.sh / .ps1) with a mutually-exclusive baseline selector that can materialize/build a baseline from another git ref’s source.
  • Updates perf pipeline documentation to describe the new PR pipeline and the new baseline-source mechanism.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
eng/pipelines/perf/sqlclient-perf-pr-pipeline.yml New manual-only PR perf pipeline wiring source-baseline parameters into the existing PerfTemplates job, omitting Kusto steps.
eng/pipelines/perf/scripts/run-perf-tests.sh Adds --baseline-source-ref / --baseline-repo-url support and refactors baseline execution to allow package or source baselines.
eng/pipelines/perf/scripts/run-perf-tests.ps1 Windows equivalent support for source-baseline acquisition (origin fetch/worktree + clone fallback) and baseline execution refactor.
eng/pipelines/perf/README.md Documents the PR pipeline, source-baseline behavior, and troubleshooting updates.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@cheenamalhotra
cheenamalhotra marked this pull request as ready for review August 8, 2026 06:33
@cheenamalhotra
cheenamalhotra requested a review from a team as a code owner August 8, 2026 06:33
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.72%. Comparing base (9b20e5e) to head (810b5cf).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4519      +/-   ##
==========================================
- Coverage   64.73%   62.72%   -2.02%     
==========================================
  Files         288      283       -5     
  Lines       44088    67041   +22953     
==========================================
+ Hits        28542    42051   +13509     
- Misses      15546    24990    +9444     
Flag Coverage Δ
CI-SqlClient ?
PR-SqlClient-Project 62.72% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

Comment thread eng/pipelines/perf/sqlclient-perf-pr-pipeline.yml
Comment thread eng/pipelines/perf/sqlclient-perf-pr-pipeline.yml
Comment thread eng/pipelines/perf/sqlclient-perf-pr-pipeline.yml Outdated
…ch category

* Build tag now records the baseline COMMIT, not just the ref. The pipeline
  cannot know the resolved SHA at compile time, so the run scripts write the
  resolved '<ref>@<sha>' label to <results>/baseline-label.txt and the post-test
  step reads it after the results are copied back. Falls back to the requested
  ref (with a warning) if the run never got as far as resolving the baseline.

* _branch_category() in perf_to_kusto.py now strips the internal ADO mirror's
  'internal/' prefix, so 'internal/main' maps to 'main' and
  'internal/release/*' maps to 'release' instead of falling through to 'other'.

Reviewer feedback on baselineRepoUrl (allowlist) and on consolidating the two
perf pipelines was discussed and resolved as no-change: the pipeline is
internal-only, and the shared logic already lives in the perf runner scripts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 08b18803-3735-44b6-8afc-1996ef05fe15
Copilot AI review requested due to automatic review settings August 11, 2026 17:52

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.

Suppressed comments (1)

eng/pipelines/perf/README.md:298

  • README says the PR pipeline build is tagged Baseline <ref>, but the pipeline/script normally resolves and tags Baseline <ref>@<short-sha> (falling back to <ref> only when baseline-label.txt is missing). This is inconsistent with the earlier “Source baseline” section and could mislead users when looking for the tag.
3. After the run, review the **run summary** (comparison, labelled `<ref>@<short-sha>`) and the
   `perf-results` artifact. The build is tagged **`Baseline <ref>`**.

@cheenamalhotra cheenamalhotra moved this from To triage to In review in SqlClient Board Aug 11, 2026
benrr101
benrr101 previously approved these changes Aug 11, 2026

Copilot AI 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.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.

Suppressed comments (2)

eng/pipelines/perf/scripts/perf_to_kusto.py:152

  • _branch_category strips the internal ADO mirror prefix ("internal/") after the pull-request detection. If a mirrored PR ref is named like "internal/pull/...", it will be categorized as "other" instead of "pull_request".

Strip the "internal/" prefix before checking for pull-request refs so both internal and public naming patterns are bucketed consistently.

    name = branch_name
    for prefix in ("refs/heads/", "refs/"):
        if name.startswith(prefix):
            name = name[len(prefix):]
            break
    if name.startswith("pull/") or branch_name.startswith("refs/pull/"):
        return "pull_request"
    # The internal ADO mirror prefixes its branches with 'internal/', so 'internal/main' and
    # 'internal/release/*' are the same branches as their public counterparts and must land in the
    # same buckets - otherwise mirrored runs would all be categorised as 'other'.
    if name.startswith("internal/"):
        name = name[len("internal/"):]
    if name == "main" or name == "master":

eng/pipelines/perf/README.md:319

  • This section says the PR pipeline build is tagged Baseline <ref>, but the PR pipeline actually tags Baseline <ref>@<short-sha> when baseline-label.txt is present (and only falls back to Baseline <ref> when the baseline SHA can't be resolved). The README should match what users will see in the ADO build list.
   `perf-results` artifact. The build is tagged **`Baseline <ref>`**.

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

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

5 participants