Skip to content

Latest commit

 

History

History
118 lines (86 loc) · 5.12 KB

aqpbm-cli.md

File metadata and controls

118 lines (86 loc) · 5.12 KB

aqpbm-cli Design

aqpbm-cli is the frontend. It builds the approxbench binary. This is where user interact with the benchmark.

Different crates are orchestrated by the CLI (this crate).

Input

User specify benchmark requirement by providing command line arguments. For supported flag, user can check the full list by:

approxbench --help

or to check sketchbench related helper message:

approxbench sketchbench --help

If user want to know what sketches are supported, user can do:

approxbench sketchbench --list-impls

Besides sketchbench, the binary has three more subcommands:

  • benchmark-external: the system level, run through system-bench (see system-bench)
  • atomic-costs: reduce a --flat JSONL stream to ASAPQuery's atomic-cost table
  • flatten: fold raw JSONL from several invocations of the same cell into --flat-shaped rows

Repetition

One invocation measures one sketch on one dataset. How many times it is measured is set by:

  • --runs and --warmup-runs: measured runs and discarded runs, in one process
  • --repeat-experiment: re-run the whole invocation in that many processes, and report a 95% confidence interval over their means
  • --trials: independent accuracy trials, each over a fresh sketch and written as its own record
    • --trial-mode says what a trial draws again: fresh draws new data, relabel keeps the data and only changes the keys, reseed keeps the data and sets the row's seed config field to mix(seed, t) for trial t
    • --trial-start is the first trial's index, so a grid of trials can be split across processes

Comparator

Accuracy is scored by a comparator. --comparator picks one by name, among those the sketch's capability can answer; omitted takes the sketch's default. For a quantile sketch scored by rank error, --quantiles gives the fractions it is asked at; omitted asks 101 fractions from 0 to 1.

Binding

For CLI to recognize what sketches are registered in sketch-bench, CLI looks up the registry in sketch-bench (registry::find, registry::check). User input (a raw string) is translated to the registry entry, whose row is a function pointer that builds the actual wrapper and returns one entry per (operation, metric) measurement. Each measurement is one primed pass per run.

Output

User can specify the benchmark result are printed on screen or to a JSONL file. User specify this by the --report flag. The output file will be a JSONL. Each line in the JSONL stands for one (operation, metric) measurement. With --trials, each trial is its own record. With --flat, the whole invocation is one line. --pretty-print indents each record over several lines instead; the output is then not a JSONL stream. --per-group-out <file> also writes a subpopulation row's per-group errors to a CSV, one row per group. Example is:

approxbench sketchbench \
    --variant count-min-sketch-fastpath-vector2d --library asap_sketchlib \
    --config 'rows=5 cols=2048' \
    --dataset uniform --size 1000000 --cardinality 100000 \
    --dtype i64 \
    --operations insert,query --metrics throughput \
    --report results.jsonl

Interaction with aqpbm-datagen

User define how input data looks like through command line. CLI will process that spec and call corresponding functions in aqpbm-datagen, and receives the data. --spec <file> reads a datagen spec file instead (examples in configs/datagen/); it overrides the inline options.

External workloads

External traces can be selected with --workload-spec and --data-root:

approxbench sketchbench \
    --workload-spec configs/workloads/google/task-usage-cpu.yaml \
    --data-root <dataset-dir> \
    --variant hyperloglog --library sketch_oxide --config 'lg_k=12' --dtype f64 \
    --operations insert --metrics throughput

--data-root defaults to $ASAP_DATASETS, else the relative path datasets (relative to the current directory).

The first adapter slice supports BOOM Arrow, Google Cluster task_usage, Alibaba microservice metrics, and custom (a user CSV, optionally gzip-compressed). Each invocation loads one half-open window before measurement; the sweep helper in scripts/dataset_tools/run_external_sweep.py runs complete tumbling windows. Rows crossing an interval boundary are excluded, and empty windows are skipped. Missing selected values, malformed rows, NaN, and infinite values fail loudly. Keyed external input is tracked separately in issue #122.

Interaction with sketch-bench

User specify the operation, metrics and sketch to run in benchmark. CLI will check against registry in sketch-bench crate, and the entry's row builds the wrapper. Once CLI receives the wrapper of benchmark components, CLI will pass a package containing the wrapper and data received previously to aqpbm-core for execution.

Interaction with aqpbm-core

Once CLI receives the data and wrapper based on the specification received by command line, CLI will pass a package containing the wrapper and data to aqpbm-core for execution. aqpbm-core will return the (benchmark) execution result back to CLI. CLI will display the result accordingly.