Skip to content

test(bench): b2-post-compaction query-latency comparison (RFC0009.7) - #225

Merged
jensholdgaard merged 2 commits into
mainfrom
bench-b2-post-compaction
Jun 15, 2026
Merged

test(bench): b2-post-compaction query-latency comparison (RFC0009.7)#225
jensholdgaard merged 2 commits into
mainfrom
bench-b2-post-compaction

Conversation

@jensholdgaard

@jensholdgaard jensholdgaard commented Jun 15, 2026

Copy link
Copy Markdown
Owner

What

Adds the third RFC0009.7 validated leg to the compaction bench: B2-post-compaction — the same template-exact query over a partition of N small files vs the single consolidated file compaction produces.

b2-post-compaction criterion group (skipped in band-scale baseline one-shot mode): builds N=32 small files (uncompacted), and the same N consolidated to one; queries both; asserts the result set is identical (compaction conserves rows); prints the hardware-independent row-group/byte counts and benches both latencies.

Verified locally

b2-post: 64000 rows; uncompacted scanned 32 row groups (33.5 MB) across 32 files
         → compacted scanned 1 row group (1.05 MB) in 1 file
uncompacted ~5.20 ms   compacted ~0.76 ms   (≈7× faster)

The latency drop is the per-file footer/metadata-read overhead compaction removes — the PR #92 B2 finding (footer reads dominate query latency) that motivated RFC 0009. The 32→1 row-group / file reduction is structural (hardware-independent); the wall-clock ratio is indicative (it'll be captured authoritatively on baseline-8vcpu-32gib for the §9 record).

fmt + clippy clean.

Why

Completes the RFC0009.7 validated evidence (D2 throughput + D3 size-band already measured authoritatively on baseline; this is the query-latency leg) ahead of the green → validated flip.

Invariants

Non-gating, indicative bench. No product code touched; compaction's row-conservation correctness stays pinned by ourios-parquet's tests.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added a new benchmark to evaluate performance improvements from data compaction. The benchmark executes queries against both uncompacted and compacted data partitions, comparing metrics such as execution time, scanned row groups, and bytes processed. Query results are validated to ensure consistency across both scenarios.

@jensholdgaard
jensholdgaard requested a review from Copilot June 15, 2026 12:21
@coderabbitai

coderabbitai Bot commented Jun 15, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@jensholdgaard, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 48 minutes and 4 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a663d8bc-5700-4d34-9ce2-77bd4434d07d

📥 Commits

Reviewing files that changed from the base of the PR and between 47394b7 and dbd1e4a.

📒 Files selected for processing (1)
  • crates/ourios-bench/benches/compaction.rs
📝 Walkthrough

Walkthrough

Adds a new b2_post_compaction criterion benchmark to compaction.rs. It introduces a B2_POST_FILES constant, a template_exact query helper, and a benchmark function that builds two partitions, compacts one with compact_partition, runs a template-exact query on both via Querier, asserts row parity, and measures latency for each side.

Changes

B2 post-compaction query benchmark

Layer / File(s) Summary
Constant and query request helper
crates/ourios-bench/benches/compaction.rs
Adds B2_POST_FILES constant, imports Querier and QueryRequest, and introduces template_exact(tenant, template_id) which constructs a QueryRequest with tenant and template ID set and all other fields as None.
b2_post_compaction benchmark and registration
crates/ourios-bench/benches/compaction.rs
Implements b2_post_compaction(): skips in baseline/band-scale mode, builds two temp partitions via build_backlog, compacts one with compact_partition, runs the same template-exact query against both using a Tokio current-thread runtime and Querier, asserts row results match, prints scan statistics, and benchmarks "uncompacted" vs "compacted" query latency. Wires the function into the criterion_group! macro alongside the existing benchmarks.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

  • jensholdgaard/ourios#120: Both PRs use compact_partition and assert that query results (rows) are conserved across compaction, making them closely related in both structure and intent.

Poem

🐇 Hop hop, the files were many and small,
I compacted them neatly into one hall.
The rows still matched — not one gone astray!
I benchmarked both sides without delay.
Less work to scan, and the timer agreed,
A tidy partition is all that I need! 🌿

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding a B2 post-compaction benchmark for query-latency comparison tied to RFC0009.7.
Description check ✅ Passed The description comprehensively covers the PR scope, motivation, and technical details, but the checklist items (cargo fmt, clippy, tests, docs) are stated in prose rather than marked as completed.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bench-b2-post-compaction

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 and usage tips.

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 an additional (non-gating) validated-side benchmark leg for RFC0009.7 by comparing template-exact query latency before vs after compaction on an identical synthetic partition, to quantify the small-file footer/metadata overhead compaction removes.

Changes:

  • Introduces b2-post-compaction criterion group that builds an uncompacted N-file partition and a compacted single-file equivalent.
  • Runs the same ourios_querier::Querier template-exact query against both stores, asserts row conservation, prints row-group/bytes-read stats, and benchmarks both latencies.
  • Skips this benchmark group when running the band-scale baseline one-shot mode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/ourios-bench/benches/compaction.rs

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 1 out of 1 changed files in this pull request and generated no new comments.

@jensholdgaard
jensholdgaard merged commit 4d52288 into main Jun 15, 2026
13 checks passed
@jensholdgaard
jensholdgaard deleted the bench-b2-post-compaction branch June 15, 2026 12:47
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.

2 participants