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
115 changes: 67 additions & 48 deletions rqe-optimizer/results/e2e-rate10/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@ The classic, multi-grouping and all (mixed + multi-grouping) workloads of
`../autosketch-vs-asap-hydra/` (r = 1, m = 1), re-planned at 1/20 of the data
rate: each series is scraped 10 times a second (every 100 ms) instead of 200,
so the classic metric carries 1e5 samples/s, `http` 1e5 records/s and `flows`
2e5 records/s. Everything else (templates, windows, accuracy curves, cost
table, p95 targets, runner) is the same as `../autosketch-vs-asap-hydra/`.
2e5 records/s. The templates, windows, accuracy curves, cost table, p95
targets and runner are those of `../autosketch-vs-asap-hydra/`, with two
differences for the end-to-end run:

- **Instant RQEs read one scrape.** `sum by (job)` and `quantile by (job)`
look back 100 ms, one sample per series (N = 1e3 per job), and are served
by 100 ms tumbling windows.
- **One RQE per schema query.** A query that several templates ask (14, 15,
17) is only its strictest template's RQE, so every e2e query is answered by
one deployment. §6.3 keeps every copy (`--keep-duplicate-queries`).

## Files

- `inputs/tables/`: the tables, `export_autosketch_eval_table.py --synthetic
--samples-per-sec 10 --keep-duplicate-queries` (classic, all, multigroup at shared = 1). Each one's
--samples-per-sec 10` (classic, all, multigroup at shared = 1). Each one's
`workloads[0].e2e` holds the queries and metrics to generate.
- `plans/<table>.plans.json.gz`: each method's chosen plans, in the format of
`../autosketch-vs-asap-hydra/README.md`, "Plans" (`--runs 1`, kept, then
Expand All @@ -32,70 +40,84 @@ the RQEs and the e2e queries, and logs it. The same groupings at 15m (1,210
items) are kept. With the two RQEs left in, the runner drops exactly these two
as unservable (ASAP and AutoSketch alike) and picks the same plans.

| Workload | RQEs at 200/s | RQEs at 10/s | Served | Dropped |
| Workload | RQEs at 200/s (§6.3) | Duplicate queries | Below the curves | RQEs at 10/s, all served |
|---|---|---|---|---|
| classic | 42 | 42 | 42 | 0 |
| multigroup | 62 | 60 | 60 | 0 |
| all | 104 | 102 | 102 | 0 |
| classic | 42 | 0 | 0 | 42 |
| multigroup | 62 | 10 | 2 | 50 |
| all | 104 | 10 | 2 | 92 |

Every chosen accuracy is measured (no theory reads), and no Hydra grid is chosen.

## Predicted cost

Cheapest plan (no latency bound), 200/s (`../autosketch-vs-asap-hydra/`) → 10/s:
Cheapest plan (no latency bound) at 10/s:

| Workload | Weights | ASAP | ASAP (no roll-ups) | PerQuery | AutoSketch |
|---|---|---|---|---|---|
| classic | CPU (vCPU) | 2.38 → 0.309 | 2.38 → 0.309 | 7.77 → 0.725 | 2,739 → 137 |
| classic | Fargate ($/h) | 0.170 → 0.0787 | 0.170 → 0.0787 | 0.623 → 0.324 | 136 → 7.02 |
| multigroup | CPU | 0.221 → 0.0950 | 0.551 → 0.114 | 1.07 → 0.140 | 10.2 → 0.554 |
| multigroup | Fargate | 0.0137 → 0.00872 | 0.0339 → 0.0158 | 0.0597 → 0.0214 | 0.430 → 0.0382 |
| all | CPU | 2.60 → 0.404 | 2.93 → 0.424 | 8.84 → 0.865 | 2,750 → 138 |
| all | Fargate | 0.184 → 0.0874 | 0.204 → 0.0945 | 0.683 → 0.345 | 136 → 7.06 |
| classic | CPU (vCPU) | 0.318 | 0.318 | 0.699 | 135 |
| classic | Fargate ($/h) | 0.0585 | 0.0585 | 0.192 | 6.41 |
| multigroup | CPU | 0.0911 | 0.110 | 0.132 | 0.487 |
| multigroup | Fargate | 0.00846 | 0.0155 | 0.0204 | 0.0348 |
| all | CPU | 0.409 | 0.428 | 0.831 | 136 |
| all | Fargate | 0.0670 | 0.0740 | 0.212 | 6.45 |

ASAP, CPU weights:

| Workload | Memory (GiB) | Deployments | RQEs rolled up |
|---|---|---|---|
| classic | 21.4 → 15.3 | 6 → 6 | 0 → 0 |
| multigroup | 1.06 → 1.34 | 5 → 9 | 52 → 41 |
| all | 22.4 → 16.7 | 11 → 15 | 52 → 41 |

Only ingest CPU scales with the rate. In the cost model, insert, merge and
query CPU and per-instance memory are constants of the cost table's row,
whatever a window holds; only DDSketch's memory is capped by the values it
holds. AutoSketch's cost is almost all ingest and falls 20×. ASAP's ingest
falls ~10× (classic: 1.84 → 0.18 vCPU), because with cheaper ingest the MILP
picks longer windows with fewer merges:

| Classic deployment | Window/slide at 200/s → 10/s (s) |
| classic | 10.7 | 7 | 0 |
| multigroup | 1.33 | 9 | 33 |
| all | 12.0 | 16 | 33 |

Classic deployments (ASAP, CPU weights):

| Deployment | Window/slide (s) |
|---|---|
| `quantile_over_time` (DDSketch α = 0.05) | 300/60 → 900/60 |
| `rate` (exact-increase) | 60/60 → 180/60 |
| top-k (CMS 3×1024) | 60/60 → 300/60 (heap 46,080 → 9,216) |

ASAP's merge and query CPU barely moves (classic 0.54 → 0.13 vCPU,
multigroup 0.106 → 0.078), so it is half or more of the cost at 10/s. Memory
barely moves either, so Fargate costs fall only ~2×. On multigroup, separate
HLL deployments at coarse groupings now cost less than rolling up from fine
ones. The p99 cube moves from DDSketch α = 0.02 to α = 0.05 and still serves
11 RQEs by roll-up. Roll-ups save 17% on multigroup (60% at 200/s) and 5% on
all (11%). With the multi-grouping templates the tightest feasible latency
bound stays 490 ms (SLAs from 1,000 ms); classic's is 21 ms.
| `sum by (job)` (exact-sum) | 0.1/0.1 |
| `quantile by (job)` (DDSketch α = 0.1) | 0.1/0.1 |
| `sum by (job) (sum_over_time)` (exact-sum) | 60/60 |
| `sum_over_time` (exact-sum) | 60/60 |
| `quantile_over_time` (DDSketch α = 0.1) | 900/60 |
| `rate` (exact-increase) | 180/60 |
| top-k (CMS 3×1024, heap 9,216) | 300/60 |

Against the previous 10/s plans (1 s instant lookback, every duplicate query,
the cost table and curves before the denser grid):

- **Memory falls ~30%** (classic 15.3 → 10.7 GiB), and Fargate costs ~25%
(classic 0.0787 → 0.0585 $/h): with the denser grid, plans pick DDSketch
α = 0.1, the coarsest that meets the target.
- **CPU rises ~3%** (classic 0.309 → 0.318 vCPU, +1 deployment):
`sum by (job) (sum_over_time)` no longer shares the instant `sum by (job)`
deployment, whose window is now 100 ms.
- **Multigroup serves 10 fewer RQEs** and costs ~4% less CPU; 33 RQEs are
rolled up (was 41).
- The tightest feasible latency bounds are unchanged: classic 21 ms, multigroup
and all 490 ms.

Every e2e query's RQEs are served by one deployment in every plan. An
independent re-plan in another session gave identical tables and identical
plans in all 120 (method, weights, kind, SLA) combinations.

## Converting the plans in ASAPQuery

`--planner saved` needs `--data-ingestion-interval-ms 100` on these tables:
the scrape interval, which instant RQEs' 0.1 s windows are whole multiples
of. With it, on ASAPQuery `main` (ProjectASAP/ASAPQuery#866), every ASAP plan
converts: classic PromQL 12/12, multigroup SQL 8/8, all SQL 8/8 and PromQL
8/8.

## Reproduce

```sh
cargo build --release -p rqe-optimizer --examples
DIR=rqe-optimizer/results/e2e-rate10; TMP=$(mktemp -d)
python3 scripts/export_autosketch_eval_table.py --synthetic --samples-per-sec 10 --keep-duplicate-queries \
--revision 44ac160dd350f695a09224fd124f0dcfe3dd825a --out $TMP/classic # classic tables
python3 scripts/export_autosketch_eval_table.py --synthetic --samples-per-sec 10 --keep-duplicate-queries \
--revision beacf68 --out $TMP/rest # all, multigroup
# copy synthetic-templates{classic,all,multigroup}-shared1.json to $DIR/inputs/tables/
# SAT: the saturation dir of ../autosketch-vs-asap-hydra/README.md, "Reproduce"
python3 scripts/export_autosketch_eval_table.py --synthetic --samples-per-sec 10 \
--revision acc2db1 --out $TMP
for t in classic all multigroup; do
f=synthetic-templates$t-shared1
cp $TMP/$f.json $DIR/inputs/tables/
target/release/examples/autosketch_vs_asap synthetic --table $DIR/inputs/tables/$f.json \
--target p95 --runs 3 --no-chosen --saturation-dir $SAT --out $DIR/$f-tp95.json
target/release/examples/autosketch_vs_asap synthetic --table $DIR/inputs/tables/$f.json \
Expand All @@ -104,8 +126,5 @@ for t in classic all multigroup; do
done
```

Without `--samples-per-sec`, the export writes the 200/s tables of
`../autosketch-vs-asap-hydra/inputs/tables/` byte for byte (but the final
newline pre-commit adds). Runs: 2026-10-13,
idle clnode109, runner at sketch-bench `eval/drop-group-rate-templates`
(4dbc20d).
Runs: 2026-10-14, sketch-bench `main` (acc2db1), on a 16-core desktop (not an
idle cluster node), so `planning_secs` are indicative only.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Loading