Skip to content

chore(test): cleanup the QWP benchmark suite - #172

Open
jovfer wants to merge 12 commits into
mainfrom
sm_qwp_bench_followup
Open

chore(test): cleanup the QWP benchmark suite#172
jovfer wants to merge 12 commits into
mainfrom
sm_qwp_bench_followup

Conversation

@jovfer

@jovfer jovfer commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add one maintained guide for the complete QWP benchmark suite and move operational tooling from doc/ to tools/qwp_bench/
  • reject incompatible or ambiguous aggregation inputs, including duplicate JSON members and direction-wide B/row overrides across multiple workload shapes; also reject failed Polars row-count checks and malformed collected JSON
  • preserve benchmark-first failure status while attempting all post-benchmark cleanup and collection steps
  • run the existing C selftest through the repository's normal offline test entry points, with portable Win32 timing and process-CPU support

Why

The merged benchmark suite was useful, but its live contract was scattered across source comments, an outdated aggregator, and an AWS runbook. Several active comments were stale; the aggregator silently omitted current C/row/Arrow paths, could mix incompatible workloads, accepted duplicate JSON members, and could apply one B/row override to multiple workload shapes.

run_cell.sh could report success after the benchmark failed, while a later cleanup, download, sidecar, or listing failure could mask the saved benchmark status and stop the remaining diagnostic sequence. It now attempts every post-benchmark step and returns failures in benchmark, JSON-validation, then post-processing order.

Registering qwp_bench_selftest in the normal cross-platform test graph also exposed POSIX-only timing helpers. The _WIN32 path now uses QueryPerformanceCounter and GetProcessTimes; the existing POSIX implementation and measured timing boundaries remain unchanged.

Scope

This is stabilization of the existing suite, not a benchmark redesign. It does not add metrics, workloads, timing-region changes, AWS cells, performance claims, automatic deployed-SHA verification, provisioning rollback, or infrastructure-teardown audit changes. The last three remain explicit operator responsibilities in the runbook.

Validation

  • python3 ci/check_docs.py
  • targeted Rust Polars example test/check
  • required cargo fmt and plain cargo clippy --tests
  • CMake/CTest qwp_bench_selftest with tests enabled
  • QUESTDB_QWP_BENCH=ON --target qwp_bench_selftest fallback with tests disabled
  • existing ci/run_all_tests.py cpp and unit entry points, including qwp_bench_selftest
  • shell syntax checks for every moved network script
  • strict stubbed _WIN32 compile and QPC/FILETIME conversion probe

Not run

  • AWS provisioning or benchmark campaign
  • a live QuestDB benchmark
  • a native Windows/MSVC build locally; the existing Windows CI remains the native compiler validation

The existing AWS workflow had already been validated; this follow-up changes local validation, failure propagation, and documentation and is accepted with offline checks.

Summary by CodeRabbit

  • New Features

    • Added comprehensive benchmark documentation and a tool for validating, aggregating, and comparing benchmark reports.
    • Added an AWS-based network benchmarking workflow, including provisioning, traffic shaping, remote execution, monitoring, and teardown.
    • Added Windows support for benchmark timing and CPU measurements.
    • Added benchmark self-test discovery and execution in automated test runs.
  • Bug Fixes

    • Improved benchmark failure, malformed-report, upload, and row-count error reporting.
    • Prevented duplicate test-target definitions in supported builds.
  • Documentation

    • Updated benchmark guides, runbooks, and maintenance documentation with current workflows and requirements.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds a benchmark contract and aggregation CLI, introduces an AWS-based network benchmark rig, improves benchmark failure propagation and portability, wires the C self-test into builds and CI, and updates benchmark documentation.

Changes

QWP benchmark suite

Layer / File(s) Summary
Benchmark contract and documentation
doc/BENCHMARKS.md, doc/README.md, ci/check_docs.py, questdb-rs/..., examples/..., .gitignore
Adds benchmark schemas, report contracts, execution guidance, network-runbook references, and documentation-check coverage; updates related source comments and ignores result directories.
Report aggregation and validation
tools/qwp_bench/aggregate.py
Adds JSON validation, report grouping, role mapping, metric conversion, Markdown/text rendering, environment output, raw output, and CLI input handling.
AWS network benchmark rig
tools/qwp_bench/net/*
Adds AWS configuration, provisioning, SSM execution, server/client bootstrap, traffic shaping, teardown, audits, and operator guidance.
Benchmark execution status and validation
tools/qwp_bench/net/run_cell.sh, questdb-rs/examples/qwp_ingress_polars.rs
Propagates benchmark, JSON, upload, and row-count failures through deterministic exit codes and tests the row-count mapping.
Portable self-test and CI wiring
CMakeLists.txt, examples/bench_json_c.*, ci/run_all_tests.py
Adds shared self-test source wiring, Windows timing and string-copy implementations, and CI discovery of qwp_bench_selftest.

Estimated code review effort: 5 (Critical) | ~90+ minutes

Sequence Diagram(s)

sequenceDiagram
  participant Laptop
  participant SSM
  participant ClientBox
  participant ServerBox
  participant S3
  Laptop->>SSM: send benchmark command
  SSM->>ClientBox: execute benchmark
  ClientBox->>ServerBox: send benchmark traffic
  ClientBox->>S3: upload JSON report
  Laptop->>S3: pull benchmark results
Loading

Suggested reviewers: bluestreak01

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and clearly related to the PR’s main theme of cleaning up and stabilizing the QWP benchmark suite.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sm_qwp_bench_followup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@doc/BENCHMARKS.md`:
- Around line 101-104: Update the top-level report field contract to explicitly
document machine and commits as mandatory fields emitted before paths, or
clearly mark them as producer-specific requirements so alternate report emitters
preserve the required provenance data.

In `@tools/qwp_bench/net/provision.sh`:
- Around line 54-56: Update the S3 bucket creation command in provision.sh to
omit --create-bucket-configuration when AWS_REGION is us-east-1, while retaining
the LocationConstraint for all other regions. Keep the existing BUCKET and
AWS_REGION values and bucket creation flow unchanged.

In `@tools/qwp_bench/net/teardown.sh`:
- Around line 4-6: Guard the directory change in teardown.sh by making the cd
command fail explicitly when it cannot enter the script directory. Keep set -uo
pipefail unchanged and ensure ./env.sh is sourced only after a successful cd.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b7b497ba-de1c-4353-9606-0c41df903abf

📥 Commits

Reviewing files that changed from the base of the PR and between 3bffcc9 and 9d6f3b5.

📒 Files selected for processing (33)
  • .gitignore
  • CMakeLists.txt
  • ci/check_docs.py
  • ci/run_all_tests.py
  • doc/BENCHMARKS.md
  • doc/README.md
  • doc/bench_parity_aggregate.py
  • examples/bench_json_c.c
  • examples/bench_json_c.h
  • examples/qwp_egress_c.c
  • examples/qwp_ingress_c.c
  • questdb-rs/Cargo.toml
  • questdb-rs/benches/column_sender.rs
  • questdb-rs/benches/decoder.rs
  • questdb-rs/examples/bench_json/mod.rs
  • questdb-rs/examples/bench_schema/mod.rs
  • questdb-rs/examples/qwp_egress_polars.rs
  • questdb-rs/examples/qwp_ingress_polars.rs
  • questdb-rs/examples/qwp_ingress_row.rs
  • questdb-rs/src/ingress/column_sender/encoder.rs
  • questdb-rs/src/ingress/column_sender/mod.rs
  • tools/qwp_bench/aggregate.py
  • tools/qwp_bench/net/README.md
  • tools/qwp_bench/net/box_bootstrap_client.sh
  • tools/qwp_bench/net/box_bootstrap_server.sh
  • tools/qwp_bench/net/box_channel.sh
  • tools/qwp_bench/net/env.sh
  • tools/qwp_bench/net/provision.sh
  • tools/qwp_bench/net/run_cell.sh
  • tools/qwp_bench/net/ssmx.sh
  • tools/qwp_bench/net/teardown.sh
  • tools/qwp_bench/net/test_run_cell.sh
  • tools/qwp_bench/test_aggregate.py
💤 Files with no reviewable changes (1)
  • doc/bench_parity_aggregate.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@doc/BENCHMARKS.md`:
- Around line 101-104: Update the top-level report field contract to explicitly
document machine and commits as mandatory fields emitted before paths, or
clearly mark them as producer-specific requirements so alternate report emitters
preserve the required provenance data.

In `@tools/qwp_bench/net/provision.sh`:
- Around line 54-56: Update the S3 bucket creation command in provision.sh to
omit --create-bucket-configuration when AWS_REGION is us-east-1, while retaining
the LocationConstraint for all other regions. Keep the existing BUCKET and
AWS_REGION values and bucket creation flow unchanged.

In `@tools/qwp_bench/net/teardown.sh`:
- Around line 4-6: Guard the directory change in teardown.sh by making the cd
command fail explicitly when it cannot enter the script directory. Keep set -uo
pipefail unchanged and ensure ./env.sh is sourced only after a successful cd.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b7b497ba-de1c-4353-9606-0c41df903abf

📥 Commits

Reviewing files that changed from the base of the PR and between 3bffcc9 and 9d6f3b5.

📒 Files selected for processing (33)
  • .gitignore
  • CMakeLists.txt
  • ci/check_docs.py
  • ci/run_all_tests.py
  • doc/BENCHMARKS.md
  • doc/README.md
  • doc/bench_parity_aggregate.py
  • examples/bench_json_c.c
  • examples/bench_json_c.h
  • examples/qwp_egress_c.c
  • examples/qwp_ingress_c.c
  • questdb-rs/Cargo.toml
  • questdb-rs/benches/column_sender.rs
  • questdb-rs/benches/decoder.rs
  • questdb-rs/examples/bench_json/mod.rs
  • questdb-rs/examples/bench_schema/mod.rs
  • questdb-rs/examples/qwp_egress_polars.rs
  • questdb-rs/examples/qwp_ingress_polars.rs
  • questdb-rs/examples/qwp_ingress_row.rs
  • questdb-rs/src/ingress/column_sender/encoder.rs
  • questdb-rs/src/ingress/column_sender/mod.rs
  • tools/qwp_bench/aggregate.py
  • tools/qwp_bench/net/README.md
  • tools/qwp_bench/net/box_bootstrap_client.sh
  • tools/qwp_bench/net/box_bootstrap_server.sh
  • tools/qwp_bench/net/box_channel.sh
  • tools/qwp_bench/net/env.sh
  • tools/qwp_bench/net/provision.sh
  • tools/qwp_bench/net/run_cell.sh
  • tools/qwp_bench/net/ssmx.sh
  • tools/qwp_bench/net/teardown.sh
  • tools/qwp_bench/net/test_run_cell.sh
  • tools/qwp_bench/test_aggregate.py
💤 Files with no reviewable changes (1)
  • doc/bench_parity_aggregate.py
🛑 Comments failed to post (3)
doc/BENCHMARKS.md (1)

101-104: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

Document the mandatory machine and commits fields.

The Rust report serializer always emits machine and commits before paths (questdb-rs/examples/bench_json/mod.rs, Lines 523-524), but this contract list omits them. Add them here or explicitly document them as producer-specific so alternate report emitters do not omit required provenance fields.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@doc/BENCHMARKS.md` around lines 101 - 104, Update the top-level report field
contract to explicitly document machine and commits as mandatory fields emitted
before paths, or clearly mark them as producer-specific requirements so
alternate report emitters preserve the required provenance data.
tools/qwp_bench/net/provision.sh (1)

54-56: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

AWS s3api create-bucket us-east-1 LocationConstraint InvalidLocationConstraint

💡 Result:

The InvalidLocationConstraint (or sometimes IllegalLocationConstraintException) error occurs when you explicitly provide us-east-1 as a LocationConstraint when creating an S3 bucket [1][2][3]. In Amazon S3, us-east-1 (US East, N. Virginia) is the default region [4][5][6]. Because of this historical design, the S3 API does not accept us-east-1 as a valid value for the LocationConstraint parameter [1][3]. How to resolve this: 1. When creating a bucket in us-east-1, do not provide any CreateBucketConfiguration parameter or LocationConstraint [1][3]. 2. For all other regions, you must specify the corresponding region in the LocationConstraint parameter [5][7]. Example for creating a bucket in us-east-1: aws s3api create-bucket --bucket YOUR-BUCKET-NAME Example for creating a bucket in a different region (e.g., us-west-2): aws s3api create-bucket --bucket YOUR-BUCKET-NAME --create-bucket-configuration LocationConstraint=us-west-2

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Locate provision.sh =="
fd -a 'provision\.sh$' . | sed 's#^\./##'

echo "== Inspect relevant create-bucket context =="
sed -n '1,90p' tools/qwp_bench/net/provision.sh

echo "== Search region/config usage =="
rg -n "QNB_AWS_REGION|AWS_REGION|AWS_DEFAULT_REGION|LocationConstraint|create-bucket|us-east-1" -S .

Repository: questdb/c-questdb-client

Length of output: 5196


Gate the S3 LocationConstraint for us-east-1.

S3 rejects --create-bucket-configuration LocationConstraint=us-east-1 with InvalidLocationConstraint; the flag should only be used for regions other than us-east-1. This can be hit whenever QNB_AWS_REGION=us-east-1 is used instead of the documented eu-west-1, so provision will fail partway through setup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/qwp_bench/net/provision.sh` around lines 54 - 56, Update the S3 bucket
creation command in provision.sh to omit --create-bucket-configuration when
AWS_REGION is us-east-1, while retaining the LocationConstraint for all other
regions. Keep the existing BUCKET and AWS_REGION values and bucket creation flow
unchanged.
tools/qwp_bench/net/teardown.sh (1)

4-6: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Guard the cd (no set -e here to catch a failed cd).

Unlike provision.sh/ssmx.sh, this script runs without -e, so a failed cd would continue and source/operate from the wrong directory. Add an explicit guard.

🛡️ Proposed fix
-cd "$(dirname "$0")"
+cd "$(dirname "$0")" || { echo "ERROR: cd to script dir failed" >&2; exit 1; }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

set -uo pipefail
cd "$(dirname "$0")" || { echo "ERROR: cd to script dir failed" >&2; exit 1; }
. ./env.sh
🧰 Tools
🪛 Shellcheck (0.11.0)

[warning] 5-5: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[info] 6-6: Not following: ./env.sh was not specified as input (see shellcheck -x).

(SC1091)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/qwp_bench/net/teardown.sh` around lines 4 - 6, Guard the directory
change in teardown.sh by making the cd command fail explicitly when it cannot
enter the script directory. Keep set -uo pipefail unchanged and ensure ./env.sh
is sourced only after a successful cd.

@jovfer jovfer changed the title bench: stabilize the QWP benchmark suite chore(test): cleanup the QWP benchmark suite Jul 23, 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.

1 participant