Repository navigation
Conversation
zzylol
force-pushed
the
feat/demo-forward-mode
branch
2 times, most recently
from
November 23, 2026 22:37
3ca52ef to
1153fc6
Compare
…store, unplanned queries proxied
--raw-store-url URL turns it on (off by default, and refused with
--no-forward). With forward mode off, nothing changes.
- Writes. An accepted Remote Write request is acknowledged (204) only
once the engine has admitted its samples and its body is queued for
the raw store.
- The queue is bounded in bytes (--raw-forward-queue-bytes, default
256 MiB, in-flight bodies included). When it is full, the request
gets 503 before the engine sees it, so a retry duplicates nothing in
either store.
- Workers on their own thread (--raw-forward-concurrency, default 4)
deliver bodies unchanged to URL/api/v1/write. They retry 429, 5xx,
timeouts and connection errors with a 100 ms to 5 s backoff, and drop
and count any other 4xx.
- Queries. Queries the plan does not answer, and every other path
(labels, series, label values, metadata), are proxied to the raw store
with x-asap-execution: forwarded. Planned answers keep
x-asap-execution: plan.
- Metrics. asap_raw_forward_* on /metrics, and raw_forward in
/api/v1/status/asap.
Design and test plan: docs/design/demo-plan.md §10.1. Tests F1-F8 are in
tests/forward_mode.rs.
…spool, by decision)
zzylol
force-pushed
the
feat/demo-forward-mode
branch
from
November 24, 2026 02:38
1153fc6 to
e7dce7c
Compare
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--raw-store-url, off by default). Each accepted Remote Write request is also delivered, unchanged, to a VictoriaMetrics single-node used as the raw store. Unplanned queries and every other API path are proxied to it, withx-asap-executionsaying who answered.count_over_time(data[10m]), answered by VictoriaMetrics (forwarded), returned 1,000 series × 1,500 samples;sum by (job) (rate(data_total[5m]))was answered by ASAP (plan).Review guide
feat/tiered-view-storage(data-plane: tiered view storage with zero-copy state views #855), one commit.data_plane/src/raw_forward.rs: the queue, its byte reservation and the delivery workers.routerindata_plane/src/lib.rs: reserve, then ingest, then commit; the fallback proxy only when forward mode is on.main.rs, and generalizingforwardintoforward_path.docs/design/demo-plan.md§10.1.Behavior: before → after
The data plane started with
data_plane --plan plan.json --listen :8088 --raw-store-url http://127.0.0.1:8428(VictoriaMetrics on :8428):POST /api/v1/write(accepted)POST /api/v1/writewhile the forward queue is fullGET /api/v1/query?query=sum by (job) (rate(data_total[5m]))x-asap-execution: planGET /api/v1/query?query=count_over_time(data[10m])(unplanned)--prometheus-urlx-asap-execution: forwardedGET /api/v1/labels,/api/v1/series,/api/v1/label/job/valuesx-asap-execution: forwardedIt serves the demo plan's §10 step 1: every query is answered, with the planned ones by ASAP. Resources are reported as ASAP + VictoriaMetrics, because both run in the forward-mode arm's cgroup.
Interfaces
data_plane/src/raw_forward.rs(new module)data_plane/src/lib.rspub struct DataPlane { pub queries: Vec<String>, pub engine: EngineHandle, pub prometheus_url: String, pub limits: remote_write::Limits, pub samples: AtomicU64, pub no_forward: bool, client: reqwest::Client, + /// Forward mode: delivers accepted Remote Write bodies to the raw store, + /// which also answers what the plan does not. `None`: off. + pub raw_forward: Option<raw_forward::RawForwarder>, } impl DataPlane { + /// Turns forward mode on: queries the plan does not answer, and any other path, + /// go to `options.url` in place of `prometheus_url`. Errors with `--no-forward`. + pub fn with_raw_forward(self, options: raw_forward::RawForwardOptions) -> anyhow::Result<Self>; }data_plane/src/main.rs(CLI)New metrics:
asap_raw_forward_queued_bytesandasap_raw_forward_queued_requests;asap_raw_forward_requests_total{outcome="delivered|dropped"};asap_raw_forward_retries_total;asap_raw_forward_delivered_bytes_total;asap_raw_forward_refused_writes_total.Usage (the smoke run above, end to end):
Algorithm changes
None: request routing and a delivery queue only.
Decisions and open questions
Needs reviewer decision: None.
Decided:
--raw-forward-queue-bytes(default 256 MiB) of samples it has already acknowledged with 204 are lost on the raw-store side.--raw-forward-queue-bytesbounds the loss, at the cost of more 503s when VictoriaMetrics slows down.--raw-store-urlin place of--prometheus-url. The proxy for every other path is added only when forward mode is on.Verification
cargo test -p data_plane --test forward_modecargo test -p data_plane(every suite)cargo fmt --all --checkcargo clippy -p data_plane --all-targetsprometheus.rs,series_ids.rsandtier_bench.rsare unchangedNew tests (
data_plane/tests/forward_mode.rs; the raw store is a recording mock):plan. Unplannedqueryandquery_range,labels,seriesand label values are proxied with their query string and markedforwarded.--no-forwardis refused.End to end: the run against VictoriaMetrics v1.155.0 in Summary and Usage.
Follow-ups
asap_forwardarm in the benchmark harness, outside this repository, runs the data plane and VictoriaMetrics in one cgroup and reports both per component and summed. It is not yet run at demo scale.--raw-forward-queue-bytesof acknowledged samples on the raw-store side (see Decided).🤖 Generated with Claude Code
https://claude.ai/code/session_01K1M6bo6sg4cEjJJhktNtL9