Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
3bc0226
rqe-optimizer: one MILP entry point with an Objective enum
milindsrivastava1997 Oct 5, 2026
ce6008d
rqe-optimizer: drop the Tco MILP objective, rename Cost to AUCCost
milindsrivastava1997 Oct 5, 2026
3490354
rqe-optimizer: per-phase cost model, workload facts, weighted AUCCost
milindsrivastava1997 Oct 6, 2026
974300c
docs: state what each rqe-optimizer cost is counted per
milindsrivastava1997 Oct 6, 2026
232cfb2
rqe-optimizer: readability pass on the cost model
milindsrivastava1997 Oct 6, 2026
af65fc4
rqe-optimizer: explain candidate slides with an example
milindsrivastava1997 Oct 6, 2026
d0598d1
docs: frame candidate slides as strictly better than finer ones
milindsrivastava1997 Oct 6, 2026
dc65cd1
docs: list the cost model's variables one per line
milindsrivastava1997 Oct 6, 2026
654ea14
rqe-optimizer: merge memory holds both operands of a pairwise merge
milindsrivastava1997 Oct 6, 2026
8da91e7
rqe-optimizer: merge memory is one accumulator, none for direct queries
milindsrivastava1997 Oct 6, 2026
4a2395a
docs: add intuition for the two-step candidate construction
milindsrivastava1997 Oct 6, 2026
87adc59
rqe-optimizer: one dominance comparison in candidate pruning
milindsrivastava1997 Oct 6, 2026
98ebb7f
docs: explain instance shape and size law in the cost model
milindsrivastava1997 Oct 6, 2026
464e17b
docs: add a glossary, link the cost export, define keys
milindsrivastava1997 Oct 6, 2026
3bde7c8
docs: call RQEs repeating atomic query expressions (RAQEs)
milindsrivastava1997 Oct 6, 2026
a0ce454
docs: flatten the candidate generation pseudocode
milindsrivastava1997 Oct 6, 2026
94ea6ca
docs: add phase to the glossary
milindsrivastava1997 Oct 6, 2026
c308abf
rqe-optimizer: rename objectives to analytical_cost_model, Objectives…
milindsrivastava1997 Oct 6, 2026
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
58 changes: 33 additions & 25 deletions docs/rqe_optimizer_TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,23 @@ implemented, what is next, and what is intentionally deferred.

## Done in v1

- Sliding deployments use `(capability, configuration, labels, x, y)`, where
`x` is window size and `y` is slide.
- Eligibility enforces capability, labels, alignment, and the RQE's measured
`accuracy_metric` constraint.
- Candidate generation uses legal windows and subset gcds of query intervals.
A deployment may serve multiple compatible RQEs.
- Sliding deployments use `(capability, configuration, metric, G, x, y)`,
where `x` is window size and `y` is slide.
- Workload facts are per metric: full label set, scrape interval, and
cardinality per label set. The arrival rate is derived from them, and
`validate_facts` reports bad facts up front.
- Eligibility enforces capability, metric, grouping, alignment, and the RQE's
measured `accuracy_metric` constraint.
- Candidate generation uses legal windows and subset gcds of query intervals,
keeping only multiples of the scrape interval. A deployment may serve
multiple compatible RQEs.
- Candidate dominance safely removes a deployment only when another covers all
of its RQEs with no worse query memory, ingest CPU, or per-RQE latency.
- The analytical model combines measured per-operation costs with label-set
cardinality and arrival rate to score ingest CPU, query CPU, merge CPU,
total CPU, query memory, and per-RQE latency.
- The Pareto vector is `(peak_query_memory, TCO_cpu, {latency_i})`.
of its RQEs with no worse instance memory, ingest CPU and memory, per-RQE
latency, or stored memory.
- The analytical model scores four phases, each with CPU and memory: ingest
(open windows), merge, query, and storage (closed windows, `(S − x)/y + 1`
for the longest lookback), plus per-RQE latency.
- The Pareto vector is `(CPU, memory, {latency_i})`.
- Eager enumeration remains available for small inputs. Streaming enumeration
retains only the incremental Pareto frontier.
- `small_problem --candidates-only` reports generated and retained candidate
Expand All @@ -25,30 +30,33 @@ implemented, what is next, and what is intentionally deferred.
can print initial example mappings.
- `scripts/export_rqe_optimizer_costs.sh` exports the 18-row measured cost
table used by `small_problem`, without changing ASAPQuery's exporter.
- The MILP uses HiGHS to minimize TCO without enumerating mappings. It accepts
optional peak-memory and per-RQE latency bounds and returns a normal mapping.
- `small_problem --milp` accepts repeatable per-RQE latency limits and includes
1-hour, 6-hour, and 1-day quantile RQEs to exercise those constraints.
- A regression test confirms the MILP matches exhaustive minimum-TCO search on
a tiny workload with shared deployment activation costs.
- Retained memory (`(x + max S) / y` instances per active deployment) is
scored, and `milp::minimize_cost` minimizes the hourly price on one EC2
machine family in fractional instances. Prices are a committed snapshot from
`scripts/fetch_ec2_pricing.py`; `small_problem --milp --machine-family NAME`
uses it.
- The MILP uses HiGHS to minimize `Objective::AUCCost { w_cpu, w_mem }`,
`w_cpu × CPU + w_mem × memory GiB` (default `(1, 0)`), without enumerating
mappings. It accepts optional per-RQE latency bounds and returns a normal
mapping.
- `small_problem --milp` takes `--w-cpu`/`--w-mem` and repeatable per-RQE
latency limits, and includes 1-hour, 6-hour, and 1-day quantile RQEs to
exercise those constraints.
- Regression tests confirm the MILP matches exhaustive search on tiny
workloads with shared deployments, at several weightings.

## Next

- Add a hard `--max-mappings` limit to streaming experiments.
- Validate accuracy after merging `S / x` sketch instances. V1 currently uses
single-instance measurements, which do not establish final query accuracy.
- Add repeated MILP solves for Pareto exploration across memory and latency
budgets, or through normalized weighted objectives.
- Add repeated MILP solves for Pareto exploration across latency budgets or
weights.
- Set `w_cpu`/`w_mem` from real prices.

## Explicitly deferred

- Query-result sharing across RQEs.
- Merge buffers and concurrent-query memory.
- Real query concurrency; memory assumes every query runs at once.
- Bursty load; CPU is a mean over time.
- A per-family instance shape for families holding every group in one
fixed-size instance (HydraKLL, sketch-bench#142).
- Top-k `k` other than the benchmark's 32, and key labels `K`.
- RQE churn, replanning, and migration cost.
- Precomputed rollups; v1 merges selected base instances at query time.
- A policy for choosing one mapping from the reported Pareto frontier.
Expand Down
Loading
Loading