Skip to content

Initial commit: add CockroachDB benchmark wrapper - #1

Open
sayalibhavsar wants to merge 4 commits into
mainfrom
initial-cockroachdb-wrapper
Open

Initial commit: add CockroachDB benchmark wrapper#1
sayalibhavsar wants to merge 4 commits into
mainfrom
initial-cockroachdb-wrapper

Conversation

@sayalibhavsar

Copy link
Copy Markdown
Collaborator

##Description
Breaking out CockroachDB benchmark from phoronix-test suite

Clerical Stuff
This closes #
Relates to JIRA: RPOPC-1288

Test Artifacts:
https://gist.github.com/sayalibhavsar/c4d945f15bd5afc35ba3a7bfb2cbba04
https://gist.github.com/sayalibhavsar/9cb24048f581c2efaeba18b0b67c2f5c

Add wrapper scripts, configuration, and documentation for running
CockroachDB benchmarks in the CPT pipeline.
@sayalibhavsar sayalibhavsar self-assigned this Jul 27, 2026
@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 818feed2-dd1f-4fd4-b87c-b0519f065dd7

📥 Commits

Reviewing files that changed from the base of the PR and between 52e1214 and a2d4cb0.

📒 Files selected for processing (1)
  • cockroachdb/cockroachdb_run
🚧 Files skipped from review as they are similar to previous changes (1)
  • cockroachdb/cockroachdb_run

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added an automated CockroachDB benchmarking workflow supporting multiple architectures, workload configurations, concurrency levels, and iterations.
    • Added performance result collection with validated JSON, combined CSV reports, averages, deviations, and optional system metrics.
    • Added benchmark options for key-value read ratios and the MovR workload.
    • Added result validation for concurrency, performance values, and timestamps.
  • Documentation

    • Added comprehensive setup, usage, configuration, output, compatibility, and troubleshooting guidance.
  • Chores

    • Added project licensing information.

Walkthrough

Adds a Bash-based CockroachDB benchmark wrapper. It manages tooling and cluster lifecycle, runs configured workloads, validates iteration results, aggregates metrics, documents operation, adds platform dependencies, and includes GPLv2 licensing.

Changes

CockroachDB benchmark execution

Layer / File(s) Summary
Benchmark contracts and configuration
result_schema.py, cockroachdb.json, cockroachdb/test_opts, cockroachdb/cockroachdb_run
Defines workload identifiers, validates result fields, lists platform dependencies, configures workloads, and adds command-line handling.
Tool and cluster lifecycle
cockroachdb/cockroachdb_run, cockroachdb/openmetrics_cockroachdb_reset.txt
Acquires shared tools, installs the architecture-specific CockroachDB binary, starts and stops a single-node insecure cluster, and controls optional PCP collection.
Workload execution and result reporting
cockroachdb/cockroachdb_run
Runs workloads across concurrency levels and iterations, parses ops/sec, writes and validates iteration results, and calculates combined averages and deviation.
Documentation and licensing
README.md, LICENSE
Documents wrapper options, workflow, workload configuration, outputs, operational notes, and troubleshooting. Adds the GPLv2 license text.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested reviewers: frival

Sequence Diagram(s)

sequenceDiagram
  participant BenchmarkUser
  participant cockroachdb_run
  participant test_tools
  participant CockroachDB
  participant PCP
  participant ResultSchema
  BenchmarkUser->>cockroachdb_run: Provide benchmark options
  cockroachdb_run->>test_tools: Acquire and install shared tools
  cockroachdb_run->>CockroachDB: Download, start, and validate cluster
  cockroachdb_run->>PCP: Start collection when enabled
  cockroachdb_run->>CockroachDB: Execute workloads
  CockroachDB-->>cockroachdb_run: Return ops/sec output
  cockroachdb_run->>ResultSchema: Validate iteration results
  cockroachdb_run->>cockroachdb_run: Aggregate and save reports
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding a CockroachDB benchmark wrapper.
Description check ✅ Passed The description explains that the CockroachDB benchmark is being separated from the Phoronix Test Suite and provides related issue and test artifact links.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

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.

@sayalibhavsar
sayalibhavsar requested a review from dvalinrh July 27, 2026 10:01

@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: 4

🧹 Nitpick comments (4)
result_schema.py (1)

16-17: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Constrain Average/Deviation to non-negative.

Both represent ops/sec and a percentage deviation, neither of which is meaningfully negative. Add ge=0 to catch malformed/parsing-error data (e.g. a negative value slipping through) at validation time instead of silently passing.

diff
-    Average: float = pydantic.Field(allow_inf_nan=False)
-    Deviation: float = pydantic.Field(allow_inf_nan=False)
+    Average: float = pydantic.Field(allow_inf_nan=False, ge=0)
+    Deviation: float = pydantic.Field(allow_inf_nan=False, ge=0)
🤖 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 `@result_schema.py` around lines 16 - 17, Update the Average and Deviation
fields in the result schema to enforce a minimum value of zero by adding the
appropriate ge=0 validation constraint while preserving the existing
allow_inf_nan=False behavior.
cockroachdb/openmetrics_cockroachdb_reset.txt (1)

1-8: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Reset template declares metrics never pushed by the wrapper.

running, numthreads, runtime, throughput, and latency are reset here but cockroachdb_run's PCP block only ever pushes iteration, concurrency, and average (results2pcp_add_value calls). These extra fields look like leftover boilerplate from another wrapper's template rather than metrics this benchmark actually reports. Trim the template to the fields actually produced, or wire up the missing pushes if they're intended.

🤖 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 `@cockroachdb/openmetrics_cockroachdb_reset.txt` around lines 1 - 8, Update the
cockroachdb reset template to contain only the metrics emitted by
cockroachdb_run: iteration, concurrency, and average. Remove running,
numthreads, runtime, throughput, and latency unless corresponding
results2pcp_add_value pushes are intentionally added.
cockroachdb/cockroachdb_run (2)

198-212: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Fixed sleep 5 for cluster readiness.

A hard-coded sleep is fragile under load (this executes once per workload×concurrency×iteration). A short poll loop against node status would be more reliable and faster on average.

🤖 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 `@cockroachdb/cockroachdb_run` around lines 198 - 212, Replace the fixed sleep
in start_cockroachdb with a short bounded polling loop that repeatedly runs
cockroach_bin node status until the cluster is ready or the timeout is reached.
Keep the existing failure path through exit_out with status 103 when readiness
is not achieved, and retain the success message after readiness is confirmed.

180-193: 🔒 Security & Privacy | 🔵 Trivial | ⚖️ Poor tradeoff

No integrity verification for downloaded CockroachDB binary.

The tarball is fetched over HTTPS but never checksummed against CockroachDB's published SHA256SUMS before extraction and execution. Worth adding a checksum check as a supply-chain hardening measure.

🤖 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 `@cockroachdb/cockroachdb_run` around lines 180 - 193, Update the CockroachDB
download flow before tar extraction to retrieve CockroachDB’s published
SHA256SUMS, compute the downloaded tarball’s SHA-256 digest, and verify it
matches the expected checksum for the selected tarball. On missing or mismatched
checksums, call exit_out with a clear integrity-verification failure and avoid
extracting or installing the archive; preserve the existing wget/curl fallback
and successful installation flow.
🤖 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 `@cockroachdb/cockroachdb_run`:
- Around line 167-171: Update the cached-install logic around cockroach_dir so
the cache is version-specific and cannot reuse a CockroachDB build created for a
different --cockroach_version. Incorporate the requested version into the
installation path or validate the existing installation’s version before
returning, while preserving reuse when the cached version matches.
- Around line 350-380: Adjust the averaging logic surrounding the iteration loop
to track the count of successfully parsed rval values, incrementing it only
after a valid parse. Use that count for samples, including the trimmed-mean
calculation and its high/low exclusions, while preserving the existing behavior
when all iterations parse successfully.
- Around line 310-317: Update both test_header_info invocations in the
CockroachDB result-generation flow to include Start_Date and End_Date in the
--field_header list, preserving the existing fields and ordering otherwise.
Ensure the generated CSV header matches the start_time and end_time result
columns consumed by csv_to_json and Cockroachdb_Results.

In `@license`:
- Around line 1-17: Rename the lowercase license header-notice template to a
distinct, non-colliding filename such as HEADER_NOTICE, while preserving its
contents and updating any references to the current license filename. Keep the
existing full LICENSE file unchanged.

---

Nitpick comments:
In `@cockroachdb/cockroachdb_run`:
- Around line 198-212: Replace the fixed sleep in start_cockroachdb with a short
bounded polling loop that repeatedly runs cockroach_bin node status until the
cluster is ready or the timeout is reached. Keep the existing failure path
through exit_out with status 103 when readiness is not achieved, and retain the
success message after readiness is confirmed.
- Around line 180-193: Update the CockroachDB download flow before tar
extraction to retrieve CockroachDB’s published SHA256SUMS, compute the
downloaded tarball’s SHA-256 digest, and verify it matches the expected checksum
for the selected tarball. On missing or mismatched checksums, call exit_out with
a clear integrity-verification failure and avoid extracting or installing the
archive; preserve the existing wget/curl fallback and successful installation
flow.

In `@cockroachdb/openmetrics_cockroachdb_reset.txt`:
- Around line 1-8: Update the cockroachdb reset template to contain only the
metrics emitted by cockroachdb_run: iteration, concurrency, and average. Remove
running, numthreads, runtime, throughput, and latency unless corresponding
results2pcp_add_value pushes are intentionally added.

In `@result_schema.py`:
- Around line 16-17: Update the Average and Deviation fields in the result
schema to enforce a minimum value of zero by adding the appropriate ge=0
validation constraint while preserving the existing allow_inf_nan=False
behavior.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3cd79350-8317-4962-9d0d-fd968f012bc4

📥 Commits

Reviewing files that changed from the base of the PR and between 9696c15 and 26023e9.

📒 Files selected for processing (8)
  • LICENSE
  • README.md
  • cockroachdb.json
  • cockroachdb/cockroachdb_run
  • cockroachdb/openmetrics_cockroachdb_reset.txt
  • cockroachdb/test_opts
  • license
  • result_schema.py

Comment thread cockroachdb/cockroachdb_run Outdated
Comment thread cockroachdb/cockroachdb_run
Comment thread cockroachdb/cockroachdb_run Outdated
Comment thread license Outdated
@sayalibhavsar
sayalibhavsar requested review from frival and kdvalin August 3, 2026 07:11
Comment thread license Outdated
Comment thread cockroachdb/cockroachdb_run Outdated
Comment thread cockroachdb/cockroachdb_run Outdated
Comment thread cockroachdb/cockroachdb_run Outdated
@sayalibhavsar

Copy link
Copy Markdown
Collaborator Author

CSV, PCP output and deviation under 3%
https://gist.github.com/sayalibhavsar/5dd73ad356f91eb0e434bdfcc67b6f53

@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: 1

🤖 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 `@cockroachdb/cockroachdb_run`:
- Around line 363-371: Update the statistics calculation around avg, sumsq, and
stddev to compute and retain a high-precision mean for the sum-of-squares loop,
while continuing to round avg only for CSV output. Use the unrounded mean when
calculating each deviation and preserve the existing output formatting and
percentage-deviation logic.
🪄 Autofix

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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8ab38b86-b4ea-4cf6-8e57-da34da42473e

📥 Commits

Reviewing files that changed from the base of the PR and between dc11c48 and 52e1214.

📒 Files selected for processing (1)
  • cockroachdb/cockroachdb_run

Comment thread cockroachdb/cockroachdb_run
Comment thread cockroachdb/cockroachdb_run Outdated
@sayalibhavsar
sayalibhavsar requested review from dvalinrh and removed request for frival August 10, 2026 14:21
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.

3 participants