Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 30 additions & 9 deletions crates/ourios-bench/benches/b2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ fn build_synthetic(bucket: &Path, filler_rows: u64) {
}
}

fn template_exact(template_id: u64) -> QueryRequest {
fn template_exact(tenant: &str, template_id: u64) -> QueryRequest {
QueryRequest {
tenant: TenantId::new("a"),
tenant: TenantId::new(tenant),
time_range: None,
template_id: Some(template_id),
severity_text: None,
Expand All @@ -126,7 +126,7 @@ fn synthetic(c: &mut Criterion) {
// Sanity: the result is the fixed TARGET_ROWS regardless of
// corpus — otherwise the latency comparison is meaningless.
let probe = rt
.block_on(querier.run(template_exact(1)))
.block_on(querier.run(template_exact("a", 1)))
.expect("probe query");
assert_eq!(
probe.rows, TARGET_ROWS,
Expand All @@ -135,7 +135,9 @@ fn synthetic(c: &mut Criterion) {

group.bench_with_input(BenchmarkId::from_parameter(total), &total, |b, _| {
b.iter(|| {
let r = rt.block_on(querier.run(template_exact(1))).expect("query");
let r = rt
.block_on(querier.run(template_exact("a", 1)))
.expect("query");
black_box(r.rows);
});
});
Expand Down Expand Up @@ -183,9 +185,30 @@ fn otel_demo(c: &mut Criterion) {
continue;
}
let querier = Querier::new(bucket.path());
// Query the corpus's own tenant (the loader is single-tenant);
// querying any other tenant would hit the empty-result early
// return and time nothing (RFC0007.5 isolation). Probe first so
// a result/tenant mismatch fails loudly instead of silently
// benchmarking a 0-row query.
let query = template_exact(built.tenant, built.busiest_template_id);
let probe = rt
.block_on(querier.run(query.clone()))
.expect("probe query");
assert_eq!(
probe.rows, built.busiest_template_rows,
"the busiest-template query must return its rows (tenant/template wired correctly)",
);
eprintln!(
"b2/otel-demo: {dir} — {} rows, {} files; querying template {} ({} rows)",
built.rows, built.files, built.busiest_template_id, built.busiest_template_rows,
"b2/otel-demo: {dir} — {} rows, {} files; tenant {:?}; querying template {} \
→ {} rows; scanned {}/{} row groups, {} B",
built.rows,
built.files,
built.tenant,
built.busiest_template_id,
probe.rows,
probe.stats.row_groups_scanned,
probe.stats.row_groups_scanned + probe.stats.row_groups_pruned,
probe.stats.bytes_read,
);

let id = path
Expand All @@ -195,9 +218,7 @@ fn otel_demo(c: &mut Criterion) {
.to_string();
group.bench_function(BenchmarkId::new("corpus", id), |b| {
b.iter(|| {
let r = rt
.block_on(querier.run(template_exact(built.busiest_template_id)))
.expect("query");
let r = rt.block_on(querier.run(query.clone())).expect("query");
black_box(r.rows);
});
});
Expand Down
5 changes: 5 additions & 0 deletions crates/ourios-bench/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ use crate::{BenchError, corpus, harness};
/// a populated query and report the result-vs-corpus relationship.
#[derive(Debug, Clone, Copy)]
pub struct BuiltStore {
/// Tenant every record was written under (the corpus loader is
/// single-tenant — [`crate::corpus`]'s `BENCH_TENANT`). A query must
/// use this tenant or it scans nothing (RFC0007.5 isolation).
pub tenant: &'static str,
/// Total rows written across all partitions.
pub rows: u64,
/// Number of partition files written (one per `*.parquet`).
Expand Down Expand Up @@ -103,6 +107,7 @@ pub fn build_query_store(corpus_dir: &Path, bucket_root: &Path) -> Result<BuiltS
counts.into_iter().max_by_key(|&(_, n)| n).unwrap_or((0, 0));

Ok(BuiltStore {
tenant: crate::corpus::BENCH_TENANT,
rows,
files,
busiest_template_id,
Expand Down
Loading