planeval, the planeval feature of the crate system-bench, is trying to answer one question:
if a query is approximated, does the application still make the same decisions.
This is phase 2 of aqpbm.
The query is planned and executed by ASAPPlanner.
The use cases are described in approx-bench-use-cases.md.
This design doc of planeval contains the following contents:
- input
- how a query is run
- output
- fidelity
- how to run
Input is a spec file in usecase-study/workloads/.
There is one synthetic spec for each use case, and more specs (*_real*) that import recorded datasets for the same use case.
A spec has two parts: the data and the queries.
Data is generated in memory from the spec. Each series has a baseline distribution. A phase changes the distribution for a period of time, for example an attack or a load surge.
Each query is a PromQL. It is evaluated every interval over a sliding window. A query can also carry a threshold that the application uses.
An arm is one setting of the planner.
The exact arm plans with no accuracy target.
An approx arm plans with an accuracy target, for example --max-error 0.01.
An arm can also say that raw samples are not kept.
The flags of an arm and of a run:
--max-error <e>: the accuracy target the plan is sized for; omitted plans the exact answer--failure-probability <p>: the probability the target may be missed (default 0.01)--no-raw: plan for a deployment that keeps no raw samples--ignore-guarantees: accept a plan whose output has no accuracy guarantee for the target--query <id>: run only these queries; repeatable--check-reference: also run the plan's query-time reference at every evaluation, and count disagreements--executor-max-bytes <n>: bytes the executor may hold while running one evaluation--data-root <dir>: the directory that imported datasets are relative to (default$ASAP_DATASETS, elsedatasets)
ASAPPlanner plans the query for the arm.
ASAPPlanner's executor runs the plan at every evaluation time.
Both run in the same process as planeval.
A plan can keep partial results as materialized views, refreshed as data arrives.
planeval writes one JSON file per arm.
It has the answer of every query at every evaluation time.
It also has the plan: the chosen sketches, their sizes and the predicted memory.
For each sketch, asap_sketchlib gives its theoretical error bound and memory.
Each evaluation also records its costs: refresh_seconds, samples_ingested, query_seconds, compile_seconds, samples_read_at_query and state_bytes.
A query also records computed_truth (its answers scored against its declared truth, computed from the data) and, with --check-reference, reference_disagreements.
A query that cannot be planned is recorded as unsupported, with the reason.
The output layout and the scoring are defined in the usecase-study crate.
planeval can also score answers it did not compute.
With --score-answers <file>, it plans and runs nothing.
It reads another system's answers (in planeval's output layout) and scores them against --exact and each query's declared truth.
--score-answers needs --exact.
scripts/use_cases/run_use_case_on_systems.py uses this to score VictoriaMetrics and ASAPQuery-backend.
--samples-out <file> also writes every generated series, so another system can be fed the same samples.
Fidelity compares the approx arm with the exact arm.
It is measured on the application, not only on the query result.
For example, does the alert fire at the same evaluations.
Each application has its own script in scripts/use_cases/cases/.
The relative error of each query result is also recorded.
cargo build --release -p system-bench --features planeval
python3 scripts/use_cases/run_use_case.py 4
tools/grafana/run.shThe binary is target/release/planeval.
run_use_case.py runs the exact arm and every approx arm of one use case.
The results go to target/grafana-data.
Grafana shows one dashboard per application.