Repository navigation
Closed
Description
Problem
rqe-optimizer reads its inputs from two separate runs of the same binary (approxbench sketchbench):
scripts/export_rqe_optimizer_costs.shbuildsAtomicCostTable: insert/merge/query CPU and memory per (sketch, config), plus one accuracy point (N=1e6, Zipf 1.1) and a merge-accuracy sweep (4–1024 shards).scripts/study_saturation.pybuilds the error-vs-N curves (plus merge curves via--merge-shards-list) over a grid of data shapes. Its--phase costalso measures insert/merge/query CPU and memory, but its docstring calls these "indicative" and defers to the export.
Since #171 the optimizer reads accuracy for lossy sketches only from the curves. This leaves:
- Dead measurement: the export's accuracy pass and merge-accuracy sweep (
rqe_merge_accuracy_grid.jsonl,atomic-costs --merge-accuracy) no longer feed the optimizer. - Duplicated measurement: both scripts measure cost, with different settings (export: 5 runs / 3 warmup at N=1e6; study: 3 runs / 1 warmup,
BENCH_WARMUP_SECS=0, at the final N). - Drift-check code:
SaturationCurves::check_cost_tableexists only to confirm that the two runs agree at the table'smeasured_at. - Leftover consumer paths:
AtomicCostEntry.query_accuracy/merge_accuracy,accuracy_at,table_accuracy(_at)are reached only through exact accumulators (whose error is trivially 0) and tests. - Grid kept in sync by hand: the export's configs are chosen to be "points of the saturation grid" (Candidate generation ignores saturation: deployments whose instances never reach N_sat are planned #156). A config missing from either side is silently ineligible.
Proposed solution
Make the saturation study the single source of optimizer inputs.
Script (study_saturation.py)
- The cost phase measures once per (sketch, config) at one canonical data shape, not once per shape, using the export's run and warmup counts. It stays serial, so it can be timed on a quiet machine (
--phase costalready supports this). - Add cost-only rows for the exact accumulators (sum, min, max, increase, delta set).
- Emit cost in a form the optimizer loads directly (or reduce it with
atomic-costs, without--merge-accuracy). - Delete
scripts/export_rqe_optimizer_costs.sh. Leavescripts/export_atomic_costs.sh(ASAPQuery's pinned grid) untouched. - UnivMon and HydraKLL have no curves, so they are ineligible today (Candidate generation ignores saturation: deployments whose instances never reach N_sat are planned #156, rqe-optimizer: drop hydra-kll from Quantile candidates #170). Leave them out until they get curves.
Consumer (rqe-optimizer)
--saturation-dirsupplies both cost (keyed by config) and accuracy (keyed by config and shape). Drop the separate cost-table input insmall_problem.- Exact accumulators return a constant 0 error instead of reading the table.
- Remove
query_accuracy/merge_accuracyfromAtomicCostEntry,accuracy_at,table_accuracy(_at), andcheck_cost_table.
Open question
This assumes per-config cost is roughly independent of data shape. That holds for CMS, HLL, KLL and DDSketch. Heap top-k insert cost does depend on skew, but the current table ignores that too, so nothing is lost. If it turns out to matter, key cost by shape; the study already loops over shapes.
Metadata
Metadata
Assignees
Labels
No labels
Activity
rqe-optimizer: one study for sketch cost and accuracy (#174)
rqe-optimizer: evaluate AutoSketch vs ASAP on the trace workloads
rqe-optimizer: evaluate AutoSketch vs ASAP on the trace workloads
rqe-optimizer: evaluate AutoSketch vs ASAP on the trace workloads
Evaluate the synthetic PromQL workload of ASAPQuery#777
rqe-optimizer: one study for sketch cost and accuracy (#174) (#178)
rqe-optimizer: evaluate AutoSketch vs ASAP on the trace workloads
Evaluate the synthetic PromQL workload of ASAPQuery#777
eval: p95 results for the synthetic grid and the traces
eval: p95 results for the synthetic grid and the traces
eval: p95 results for the synthetic grid and the traces
eval: p95 results for the synthetic grid and the traces
eval: AutoSketch vs. ASAP on the synthetic mixed set (cost by use; fr…