feat: sketch capability model + per-stage budgets + optimization problem formulation - #119
Merged
Merged
Conversation
The optimizer now receives deployment constraints from the workload's StageResourceBudgets and uses them in cost estimation: 1. DeploymentConstraints::from_budgets(StageResourceBudgets) — converts agent/backend memory budgets into optimizer constraints 2. main.rs handle_plan() now calls QueryOptimizer::with_constraints() instead of QueryOptimizer::new() — both optimizer call sites updated 3. DefaultCostModel enhanced: - Memory penalty: sketches exceeding agent_memory_bytes get 10× cost - Bandwidth penalty: output exceeding agent_backend_bandwidth get 10× cost - Sliding window penalty: if agent doesn't support sliding, 10× CPU cost - WindowedAgg costed with actual sketch memory from directory estimates - Partition and Dedup have non-unity cost factors 3 new tests: constraints_from_budgets, constrained_optimizer_penalises, unconstrained_optimizer_normal_cost. 318 total pass. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zzylol
force-pushed
the
pr/window-optimizer-gaps
branch
from
April 4, 2026 17:47
e799eb6 to
6ddb929
Compare
zzylol
force-pushed
the
pr/window-optimizer-gaps
branch
6 times, most recently
from
April 4, 2026 19:26
ccec4ea to
670cac9
Compare
Both optimizer calls now use with_constraints() AND physical_plan_to_staged(): constraints = DeploymentConstraints::from_budgets(&budgets) (opt_qe, _) = QueryOptimizer::with_constraints(raw_bps, constraints).optimize(qe) (staged, _) = physical_plan_to_staged(&opt_qe, &budgets) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zzylol
force-pushed
the
pr/window-optimizer-gaps
branch
from
April 4, 2026 19:35
670cac9 to
e029122
Compare
zzylol
added a commit
that referenced
this pull request
Apr 4, 2026
Rebased on latest main. Dropped stale controller changes (already on main via PRs #96, #116, #117, #119). Only benchmark tooling remains: - replay.py: replay DEBS dataset through OTel collector - run.py: orchestrate benchmark runs - scrape.py: collect Prometheus metrics during run - analyze.py: parse benchmark results - compare.py: compare sketch results to ground truth - summarize.py: generate summary tables - ground_truth/: ground truth computation for accuracy checking Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
zzylol
added a commit
that referenced
this pull request
Apr 4, 2026
Rebased on latest main. Dropped stale controller changes (already on main via PRs #96, #116, #117, #119). Only benchmark tooling remains: - replay.py: replay DEBS dataset through OTel collector - run.py: orchestrate benchmark runs - scrape.py: collect Prometheus metrics during run - analyze.py: parse benchmark results - compare.py: compare sketch results to ground truth - summarize.py: generate summary tables - ground_truth/: ground truth computation for accuracy checking Co-authored-by: zz_y <zeyingz@umd.edu> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
SieDeta
pushed a commit
that referenced
this pull request
Apr 17, 2026
…ets (#119) The optimizer now receives deployment constraints from the workload's StageResourceBudgets and uses them in cost estimation: 1. DeploymentConstraints::from_budgets(StageResourceBudgets) — converts agent/backend memory budgets into optimizer constraints 2. main.rs handle_plan() now calls QueryOptimizer::with_constraints() instead of QueryOptimizer::new() — both optimizer call sites updated 3. DefaultCostModel enhanced: - Memory penalty: sketches exceeding agent_memory_bytes get 10× cost - Bandwidth penalty: output exceeding agent_backend_bandwidth get 10× cost - Sliding window penalty: if agent doesn't support sliding, 10× CPU cost - WindowedAgg costed with actual sketch memory from directory estimates - Partition and Dedup have non-unity cost factors 3 new tests: constraints_from_budgets, constrained_optimizer_penalises, unconstrained_optimizer_normal_cost. 318 total pass. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
SieDeta
pushed a commit
that referenced
this pull request
Apr 17, 2026
Rebased on latest main. Dropped stale controller changes (already on main via PRs #96, #116, #117, #119). Only benchmark tooling remains: - replay.py: replay DEBS dataset through OTel collector - run.py: orchestrate benchmark runs - scrape.py: collect Prometheus metrics during run - analyze.py: parse benchmark results - compare.py: compare sketch results to ground truth - summarize.py: generate summary tables - ground_truth/: ground truth computation for accuracy checking Co-authored-by: zz_y <zeyingz@umd.edu> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Wires the existing
DeploymentConstraintsinto the actual optimizer pipeline.Previously
DeploymentConstraintsandwith_constraints()were defined butnever called — the optimizer ran unconstrained.
Changes
controller/src/main.rshandle_plan()optimizer calls now useQueryOptimizer::with_constraints()instead of
QueryOptimizer::new()DeploymentConstraints::from_budgets(&StageResourceBudgets)convertsworkload-derived budgets into optimizer constraints
controller/src/algebra/optimizer.rsNew:
DeploymentConstraints::from_budgets()StageResourceBudgets(agent/backend memory) intoDeploymentConstraintsEnhanced:
DefaultCostModel::estimate()WindowedAggcosted with actual sketch memory fromdirectory::estimated_sketch_memory_bytesagent_memory_bytesget 10× memory costagent_backend_bandwidthget 10× bandwidth costagent_supports_slidingis false, sliding WindowedAgg gets 10× CPU costPartitionandDeduphave non-unity cost factors (0.8, 0.9)How it works
The optimizer's cost model now returns inflated costs when constraints are
violated, causing cost-sensitive rewrite rules to prefer alternatives
(e.g., deferring a large sketch from Agent to Backend).
Tests
3 new tests:
constraints_from_budgets— verifies conversion from StageResourceBudgetsconstrained_optimizer_penalises_large_sketch— tiny budget → 10× memory penaltyunconstrained_optimizer_normal_cost— no constraints → normal cost318 total tests pass.
🤖 Generated with Claude Code