Skip to content

Migrate ASAPQuery-backend's DAG data plane into ASAPQuery and run ASAPPlanner plans end to end #918

Open

Description

@milindsrivastava1997

Status: agreed direction (Milind, Zeying), 2026-10-27. Open questions at the end.

Context

Decision

Move ASAPQuery-backend's data plane into ASAPQuery, run it side by side with the legacy engine behind --plan plan.json, reach parity on live e2e tests, switch over, then delete the legacy engine. Sunset the ASAPQuery-backend repo. asap-executor stays in ASAPPlanner as a pinned git dependency.

Target architecture

Component Responsibility Comes from
Physical operator library All computation: operators, sketch build/merge/readout asap-executor (ASAPPlanner). Replaces ASAPQuery's accumulators, window merging and native query DAG
SDS Metadata: which summaries the plan defines, which panes exist and are ready, retention/eviction, definition → storage key backend sds.rs (bookkeeping half)
Storage engine Holds summary states and their metadata by key backend sds.rs (storage half); ASAPQuery's Store designs inform later persistence/spill
Precompute engine Turns ingested samples into panes by running the plan's ingestion-time sub-DAGs; watermarks backend precompute.rs, per_sample.rs; fed by ASAPQuery's ingest adapters. Multi-worker partitioning re-added later
Query engine Receives queries via protocol adapters, binds a plan root's inputs (stored panes, raw windows), runs it, falls back ASAPQuery's servers/adapters/fallback + backend query.rs

Code lives in one new dag module in asap-query-engine (sds, storage, precompute, query). A plan subcommand wraps plan_installable (the backend's control plane). No new crates.

Plan

  1. Generalize the PromQL harness (legacy only). Suite YAML gains optional accuracy/cadence fields and generates both legacy config and a PlanningWorkload. Execution header and scoreboard (below). Watermark endpoint added to legacy. External perf capture.
  2. Copy the backend in behind --plan. Plain copy, commit cites backend SHA. Add the DAG arm to promql-compliance, benchmarks/ and experiment_run_e2e.py. Transfer open backend issues (gh issue transfer), archive the repo; no further changes land there.
  3. sql-compliance/. Mirrors promql-compliance with ClickHouse as reference. The DAG arm refuses all SQL until step 5 — that is expected and visible.
  4. PromQL parity. Refactor into the five components (SDS/storage split first), range queries, scale fixes (Query runs fail with "execution memory limit exceeded" above ~2M raw samples per window ASAPQuery-backend#848, A pane never closes when its series stops, so every query over that window falls back ASAPQuery-backend#772, Series interner grows without bound under series churn ASAPQuery-backend#842), multi-worker precompute — each change checked by the harness.
  5. SQL on the DAG engine. Table rows from JSON ingest into precompute; ClickHouse adapter routes to the plan. Query-time SQL plans are refused with an "unsupported plan" error; no support added.
  6. Switch over. Elastic moved to the DAG engine (see open questions), legacy engine, asap-planner-rs and old configs deleted.

Testing

Goal: harnesses that expose correctness and performance bugs, for the whole repo, PromQL and SQL, covering plan → install → live data plane on real data.

  • Tiers. cargo test (fast, in-process; the backend's tests) · Docker compliance suites in CI (promql-compliance, new sql-compliance, benchmarks/) · CloudLab via asap-tools for scale.
  • One workload definition. The suite YAML is the source of truth; both engines are planned from it.
  • One engine per process. Legacy and DAG run as separate containers next to the reference (Prometheus or ClickHouse), so neither skews the other's perf and no answer silently falls back between engines.
  • Who answered. Both engines set x-asap-execution: plan | forwarded | refused plus a reason; tests run with forwarding off. A forwarded answer never counts as a pass.
  • Scoreboard. Per query and engine: answered-correct / answered-wrong / not answered (reason). Correct = within the plan's accuracy guarantee for that query, against the reference. Legacy-vs-DAG diff is a diagnostic only (they use different asap_sketchlib versions).
  • Deterministic time. Seed data in the past, start the engine with --stream-start-ms = seed start, send the watermark barrier after seeding instead of sleeping. Off-grid evaluation times are reported as "not answered: off grid".
  • Performance. Ingest throughput, query latency, CPU, RSS, measured from outside the process (harness timings, container stats). Reported as trends (JSON artifact per run); never blocks PRs.
  • Parity = switch-over criterion. For every suite, the DAG engine answers at least what legacy answers, within guarantee. Perf is reported, not gated.

Decisions log

Topic Decision
Executor location Stays in ASAPPlanner, pinned by git rev; bumped manually
Migration style Side by side, parity, then switch over
ASAPQuery-backend Frozen now, archived after the copy
SDS vs storage Two components: SDS metadata; storage holds states + their metadata
Precompute windows Tumbling panes only; sliding windows and late-data forwarding re-added later if needed
Query-time plans PromQL: kept (already works). SQL: refused with an error
Query → plan matching Exact text for now; follow-up issue for pattern/capability matching
Plan install At startup only; no hot reload
Elastic Must survive switch-over
MILP (ProjectASAP/sketch-bench#143 / #790) Stays for now; moves into ASAPPlanner later

Open questions

  1. Storage form. Live in-memory states first (current backend; fast, no persistence), with serialized bytes (ASAPv1) added alongside persistence? Proposed: yes.
  2. Elastic. QueryDSL, Elastic SQL, or both? ASAPPlanner has no QueryDSL frontend; Elastic SQL could use the SQL frontend.
  3. RQE route (/api/v1/rqe_query) and promsketch_store. Survive or drop at switch-over? Proposed: drop unless an active eval needs them.
  4. Owners and dates for each step, and target dates for PromQL and SQL parity.

Follow-up issues to file (link here as sub-issues)

  • Query → plan matching by pattern and capability, falling back from exact text (ASAPQuery).
  • One issue per plan step above.

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions