Skip to content

feat(asap-tools): feed the sketchdb arm in the ClickHouse runner - #900

Merged
milindsrivastava1997 merged 3 commits into
mainfrom
874-pr2-feed-sketchdb-arm
Oct 15, 2026
Merged

milindsrivastava1997 merged 3 commits into
mainfrom
874-pr2-feed-sketchdb-arm

Conversation

@milindsrivastava1997

@milindsrivastava1997 milindsrivastava1997 commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Part of #874 (2 of 3). Stacked on #899; review only its commits.

Problem: experiment_run_clickhouse.py refused sketchdb with dataset.paced_feeder: its engine ingested dataset.local_data_file, which a fed config doesn't have.

Fix:

  • In a fed run, sketchdb starts the engine on remote-write ingest (streaming.remote_write.base_port/path) instead of JSON.
  • Once the engine is ready, _start_feed recreates the tables and starts the feed to ASAPQuery only; then set_data_start, as baseline does.
  • Fed sketchdb feeds no ClickHouse copy and sets forward_unsupported_queries: false. The issue proposed a shared feed so forwarded queries had data, but a ClickHouse feeder during sketchdb would load the node its CPU and latency are measured on, which baseline never pays, and the generated arm (feat(asap-tools): sketchdb arm for sketch-bench ClickHouse workloads #901) runs only planned queries. An unplanned query now fails visibly instead. _feed_sinks holds this choice. Unfed (JSON) sketchdb runs still forward.
  • Queries wait no flow.steady_state_wait: the aligned groups' starting delay covers it. The mode waits out the feed before syncing, so feeders write their stats.
  • A fed dataset has no dataset.precompute to build the planner's input from, so fed sketchdb needs controller.prebuilt_output_dir; this is checked before ClickHouse starts. No ClickHouse discovery is used.
  • The feed's alignment reads a mode that runs every query group, not whichever mode is listed first (sketchdb may skip trailing groups, fix(asap-tools): give sketchdb its own SQL in ClickHouse runs #899).

Not covered by tests: the wiring inside main(); it needs a real run (see #874).

Tests: tests/test_experiment_run_clickhouse.py (fed sketchdb needs a prebuilt plan; each mode's feed sinks; sketchdb's queries follow its own feed's start).

🤖 Generated with Claude Code

@milindsrivastava1997 milindsrivastava1997 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review findings (Claude Code).

experiment_modes,
yaml.safe_load(f),
minimum_experiment_running_time,
controller_prebuilt_output_dir,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feed alignment just above (~652–657: the LCM of the aligned groups' intervals and the align_to_interval / query_time_offset checks) reads only experiment_modes[0]'s client config. Its comment, 'Every mode's client config has the same query timing', stopped being true once sketchdb can skip trailing groups (#899).

Example: a config with experiment: [{mode: sketchdb}, {mode: baseline}]. The LCM then covers only the structured groups. If a PromQL group has an interval no structured group has (15 s vs 10 s), baseline's feed start isn't a multiple of 15 s, and its floored eval windows start before data_start and score partial windows. An invalid offset in a group only baseline runs also passes the pre-start check. Suggest using the union of groups across all modes, or baseline's config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7866734: the alignment and aligned-group checks now read the client config of a mode that runs every group (any mode but sketchdb).

f"?database={CLICKHOUSE_DATABASE}"
}
if query_engine_url is not None:
sinks[SINK_QUERY_ENGINE] = query_engine_url

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fed sketchdb runs this starts two feeder processes per metric on the measured node (engine remote-write plus ClickHouse INSERT); baseline feeds ClickHouse only. Sketchdb's monitored CPU and latency therefore include competition baseline never sees, which biases the comparison against ASAPQuery. The ClickHouse feed is needed only for forwarded queries, and the generated sketchdb arm (#901) runs only structured groups, which ASAPQuery answers itself.

Separately: this sink choice duplicates paced_feeder_sinks(mode, ...) in experiment_utils/services/paced_feeder.py, so the rule 'sketchdb also feeds the query engine' now lives in two places. Suggest reusing that helper.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6c58a8b: a fed sketchdb run now feeds only ASAPQuery and sets forward_unsupported_queries: false, so it doesn't pay for a ClickHouse feeder that baseline never runs. _feed_sinks holds the choice, with tests. On the duplication: paced_feeder_sinks builds Prometheus remote-write sinks, so it isn't reused here.

)

# Start query engine (precompute + JSON ingest + ClickHouse fallback)
# Start query engine (precompute + ClickHouse fallback), ingesting

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale comment: the section header above (~line 772) still says --- sketchdb mode: precompute engine + JSON ingest + ClickHouse fallback ---, which contradicts this branch setting ingest_json_config = None in fed runs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7866734.

milindsrivastava1997 and others added 3 commits October 15, 2026 12:28
With dataset.paced_feeder, sketchdb mode now starts the engine on
remote-write ingest and feeds it and ClickHouse (which answers forwarded
queries) from one start and seed, then points the aligned query groups
at that start, as baseline does. A fed dataset has no dataset.precompute
for the planner's input, so fed sketchdb needs
controller.prebuilt_output_dir.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The feed's alignment and the aligned groups' checks read the first
mode's client config, which for sketchdb may lack trailing groups; they
now read a mode that runs every group.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A ClickHouse copy of the feed during sketchdb only served queries
ASAPQuery forwards, and loaded the node sketchdb's CPU and latency are
measured on. Fed sketchdb now feeds the engine alone and forwards no
unsupported queries, so an unplanned query fails instead of being
answered by ClickHouse.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@milindsrivastava1997
milindsrivastava1997 changed the base branch from 874-asap-tools-feed-the-sketchdb-arm-in-the-clickhouse-runner to main October 15, 2026 16:28
@milindsrivastava1997
milindsrivastava1997 merged commit 8864155 into main Oct 15, 2026
11 of 12 checks passed
@milindsrivastava1997
milindsrivastava1997 deleted the 874-pr2-feed-sketchdb-arm branch October 15, 2026 16:58
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.

1 participant