Skip to content

Expand query execution coverage in the performance test suite - #4789

Open
benrr101 wants to merge 7 commits into
mainfrom
dev/russellben/more-sqlcommand-perftests
Open

benrr101 wants to merge 7 commits into
mainfrom
dev/russellben/more-sqlcommand-perftests

Conversation

@benrr101

@benrr101 benrr101 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

The existing benchmarks cover a limited set of command and reader scenarios, and some include fixture preparation or measure iterations too short for stable results. This change expands coverage within the existing runners and focuses measurements on command execution and result consumption.

Changes

  • Cover synchronous and asynchronous command APIs across SQL text, parameterized queries, and stored-procedure RPCs.
  • Add typed getters and GetValues alongside reader drain baselines, including mixed 16- and 64-column rows with NULL values.
  • Cover binary and Unicode large values through materialization, chunked getters, and streaming, including 128 MiB plaintext payloads and both Default and SequentialAccess.
  • Exercise MARS enabled and disabled, while retaining supported Always Encrypted scenarios.
  • Move reusable commands, buffers, and fixture preparation outside measurement; validate fixtures and consumed results outside timing.
  • Batch 512 sequential executions in fast command benchmarks, with an explanatory comment and OperationsPerInvoke normalization so results remain per command.

Infrastructure changes retain existing runner names, discovery, and configuration entry points. BenchmarkDotNet filtering and listing now work across enabled units, and invalid configurations or failed cases produce a failing exit code.

Validation

  • Completed all 1,429 cases across 18 enabled units against a local SQL Server. The existing pool-contention runner required a retry with a longer case timeout.
  • Reran all 48 command cases after batching: the shortest measured iteration was 194 ms, with no iteration-timing warnings.
  • Command cases exceeding 20% variation dropped from 3 to 0; median variation dropped from 6.4% to 2.4%.
  • Release build and all seven runner checks passed.

Measurement boundaries have changed, so driver comparisons should use the same updated benchmark sources rather than historical results from the previous implementations.

🤖

Implemented and validated entirely using 🤖

@benrr101 benrr101 added this to the 8.0.0-preview2 milestone Oct 5, 2026
Copilot AI balanced review requested due to automatic review settings October 5, 2026 15:42
@benrr101
benrr101 requested a review from a team as a code owner October 5, 2026 15:42

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.

Copilot review overview

🟡 Changes recommended

Timeout validation conflicts with existing semantics, and the documented regression-check script is missing.

Review effort: Balanced
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Expands performance benchmarks for command execution, typed readers, large payloads, MARS, and Always Encrypted scenarios.

Changes:

  • Adds broader synchronous/asynchronous command and reader benchmarks.
  • Moves fixture setup and allocations outside measured regions.
  • Adds filtering, validation, and benchmark failure reporting.

Validation was source inspection only; tests were not run.

File Description
runnerconfig.jsonc Adds 128 MiB payload and longer timeouts.
README.md Documents coverage and execution.
Program.cs Adds filtering and failure handling.
DBFramework/​Table.cs Adds setup timeouts and disposal.
DBFramework/​MixedRowFixture.cs Creates mixed-row fixtures.
DBFramework/​DbUtils.cs Applies command timeouts.
Config/​Loader.cs Disables nullable analysis.
Config/​Config.cs Introduces specialized job types.
Config/​CommandRunnerJob.cs Adds defaults and validation.
SqlCommandRunner.cs Expands command API benchmarks.
LargeDataReadRunner/​Plaintext.cs Adds binary/text accessor coverage.
LargeDataReadRunner/​LargeDataReadRunnerBase.cs Centralizes large-value setup and validation.
LargeDataReadRunner/​AlwaysEncrypted.cs Adapts encrypted large-value benchmarks.
DataTypeReaderRunner/​ReaderCase.cs Models individual and mixed reader cases.
DataTypeReaderRunner/​Plaintext.cs Adds mixed rows and sequential access.
DataTypeReaderRunner/​DataTypeReaderRunnerBase.cs Adds typed and GetValues benchmarks.
DataTypeReaderRunner/​AlwaysEncrypted.cs Adapts encrypted reader benchmarks.
CommandRunnerBase.cs Centralizes connection and command lifecycle.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/Microsoft.Data.SqlClient/tests/PerformanceTests/Config/CommandRunnerJob.cs Outdated
Comment thread src/Microsoft.Data.SqlClient/tests/PerformanceTests/README.md Outdated
Remove check for negative TimeoutMinutes in CommandRunnerJob.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 5, 2026 16: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.

Copilot review overview

🟡 Changes recommended

Mixed-row generation is nondeterministic, and the documented regression-check script is missing.

Review effort: Balanced
Findings: 1 High severity · 1 Low severity

Open (2)
Resolved since last review (1)

@cheenamalhotra cheenamalhotra removed this from the 8.0.0-preview2 milestone Oct 5, 2026
@benrr101 benrr101 added this to the 8.0.0-preview1 milestone Oct 5, 2026

@priyankatiwari08 priyankatiwari08 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.

Partial review - diff is large, so I focused on SqlCommandRunner, CommandRunnerBase, DataTypeReaderRunnerBase, LargeDataReadRunnerBase, MixedRowFixture and Program.cs.

  • Async readers/streams lost await using in six places - see inline.
  • Program.cs: the first failing unit sets ExitCode = 1 and returns, so later enabled units are silently skipped; also BenchmarkRunner.Run(type, config, args) lets command-line args override the unit's job config that was just validated.

await using SqlCommand cmd = new($"SELECT Data FROM {_table.Name}", _connection);
await using SqlDataReader reader = await cmd.ExecuteReaderAsync(CommandBehavior);

using SqlDataReader reader = await ReadCommand.ExecuteReaderAsync(CommandBehavior);

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.

This was await using before - plain using forces synchronous disposal of an async reader, which can block draining remaining results and skews what the async benchmark measures. Same downgrade in DataTypeReaderRunnerBase (3x), SqlCommandRunner, and the GetStream path.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure, I'll just add those wherever valid.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 16:59

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.

Copilot review overview

🟡 Changes recommended

The harness incorrectly fails for --info, and the README references a regression script that is not checked in.

Review effort: Balanced
Findings: 1 High severity · 1 Low severity

Open (2)
Resolved since last review (1)

Comment thread src/Microsoft.Data.SqlClient/tests/PerformanceTests/Program.cs Outdated
Copilot AI balanced review requested due to automatic review settings October 7, 2026 18:04

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.

🔵 Needs a closer look

The extensive SQL Server, MARS, large-payload, and Always Encrypted matrix requires human review of independently executed benchmark results.

0 open findings

2 resolved since last review

🧠 Review effort: Balanced

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

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

5 participants