Skip to content

feat: standalone precompute engine replacing Arroyo streaming pipeline#228

Merged
milindsrivastava1997 merged 12 commits intomainfrom
pr/A-precompute-engine-core
Mar 31, 2026
Merged

feat: standalone precompute engine replacing Arroyo streaming pipeline#228
milindsrivastava1997 merged 12 commits intomainfrom
pr/A-precompute-engine-core

Conversation

@zzylol
Copy link
Copy Markdown
Contributor

@zzylol zzylol commented Mar 25, 2026

Summary

Design document: precompute_engine_design_doc.md

  • Adds a standalone, single-machine multi-threaded precompute engine that replaces the Arroyo streaming pipeline
  • Implements PrecomputeEngine with configurable worker pool, SeriesRouter, WindowManager, and SeriesBuffer
  • Wires up DatasketchesKLL accumulator in AccumulatorFactory with E2E test
  • Adds raw-only passthrough mode for debugging
  • Connects engine to the main binary via --enable-prometheus-remote-write flag
  • Adds debug-level tracing spans for latency measurement

This is PR A of 6 stacked PRs splitting #162

Stacking order:

  • PR A (this) → main: Core engine
  • PR B → PR A: E2E tests + sliding window fix
  • PR C → PR B: Multi-connector ingest + pane-based sliding window
  • PR D → PR C: Benchmarks + scalability tests
  • PR E → PR D: Correctness tests + hand-crafted vs ArrovoSketch comparison test
  • PR F → PR E: Refactoring + benchmarking binary

Test plan

  • cargo build compiles successfully
  • E2E test binary runs: cargo run --bin test_e2e_precompute
  • Precompute engine starts without errors when --enable-prometheus-remote-write is passed

zzylol and others added 7 commits March 28, 2026 14:13
Implements a single-node multi-threaded precompute engine as a new module
and binary target within QueryEngineRust. The engine ingests Prometheus
remote write samples, buffers them per-series with out-of-order handling,
detects closed tumbling/sliding windows via event-time watermarks, feeds
samples into accumulator wrappers for all existing sketch types, and emits
PrecomputedOutput directly to the store.

New modules: config, series_buffer, window_manager, accumulator_factory,
series_router, worker, output_sink, and the PrecomputeEngine orchestrator.
The binary supports embedded store + query HTTP server for single-process
deployment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace sketch_db_common::enums::QueryLanguage import with
query_engine_rust::data_model::QueryLanguage in the standalone binary,
and integrate PrecomputeEngine into main.rs as an alternative to the
removed PrometheusRemoteWriteServer.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Handle top-level aggregation types (DatasketchesKLL, Sum, Min, Max,
etc.) directly in the factory match, fixing the fallback to Sum that
broke quantile queries. Also preserve the K parameter in
KllAccumulatorUpdater::reset() instead of hardcoding 200.

Add test_e2e_precompute binary that validates the full ingest ->
precompute -> store -> query pipeline end-to-end.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When pass_raw_samples is enabled, each incoming sample is emitted
directly to the store as a SumAccumulator without windowing or
watermark advancement. This supports use cases where raw passthrough
is needed instead of sketch-based aggregation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…te engine

Instrument the ingest→worker→store pipeline with debug_span! and an
Instant-based e2e latency log. All spans are at debug level so there is
zero overhead at the default info level. Enable FmtSpan::CLOSE in both
binaries to emit span durations when RUST_LOG=debug.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rfile dependency cache layer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…and apply fmt

- Restore decode_prometheus_remote_write and related types that were
  fully commented out in prometheus_remote_write.rs
- Fix CountMinSketchAccumulator field access via .inner. in accumulator_factory
- Fix AggregationConfig::new call in worker test (missing slide_interval arg,
  wrong types for spatial_filter/metric, extra trailing None)
- Apply cargo fmt across precompute engine files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zzylol zzylol force-pushed the pr/A-precompute-engine-core branch from eeba11e to 8af309b Compare March 28, 2026 19:13
zzylol and others added 4 commits March 28, 2026 14:19
The sketch field on CountMinSketch is a method not a field; replace
the manual xxhash loop in CountMinSketchUpdater::update_keyed with a
call to acc.inner.update() which encapsulates the same logic.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove unused `serde_json::json` import in worker.rs test
- Add `Default` impls for SumAccumulatorUpdater, IncreaseAccumulatorUpdater, MultipleSumUpdater, MultipleIncreaseUpdater, NoopOutputSink
- Suppress `too_many_arguments` on Worker::new

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds a "Why not ArroyoSketch?" subsection to the "Why this PR is needed"
section of the precompute engine design doc, with a comparison table and
prose explaining the operational tradeoffs between the two approaches.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@milindsrivastava1997 milindsrivastava1997 merged commit 279f559 into main Mar 31, 2026
3 checks passed
@milindsrivastava1997 milindsrivastava1997 deleted the pr/A-precompute-engine-core branch March 31, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants