Repository navigation
feat(asap-aware-mapping)!: price sketch nodes from measured operation costs in Stage 3 - #734
Conversation
… costs in Stage 3 PlanSelectionSettings::measured_operation_costs holds the deployment's measured CPU ns per (sketch parameters, update|merge|estimate). A sketch build, pane-chain build, merge or estimate with an entry is priced from it; every other node from the formulas. NodeCost::price_source reports which. Removes the legacy core's PhysicalPlanCostModel, empirical_cost and empirical_resources (and ResourceCalibration); what they did beyond this is tracked in #733.
…eline --measured-operation-costs convert_rqe_atomic_costs turns sketch-bench's per-operation table into plan selection's measured table (exact and Hydra rows skipped with the reason). stage_pipeline --measured-operation-costs <file> passes it to Stage 3, and each node in the document carries price_source. The committed example 1 fixture gains price_source: "analytical" per node.
462eaf4 to
281211f
Compare
…rrors and cost source for the measured table - The newest window's compaction prices each of its (k - 1)·I merges from the state's measured merge when the table has one. - DuplicateMeasuredOperationCost (names the sketch and operation) and MeasuredCostsWithoutCpuSpeed replace the reused InvalidCalibration. - CandidateCost::source says analytical, measured or mixed. - Move the KLL failure-probability lookup test from empirical_cost; document that near-miss parameters are priced from the formulas. - Drop NodePriceSource's unused Default; name detail-text locals.
|
/// Which prices one node's CPU operations came from. New type. |
|
A node of the physical plan DAG ( |
Closes #679.
Why
Stage 3 prices a sketch's CPU from its own formulas (e.g. "depth" operations per KLL or DDSketch update). A deployment that has measured its sketches, such as sketch-bench's
rqe_atomic_costs.json, had no way to give Stage 3 those measured times. The only measured path was the legacy core'sPhysicalPlanCostModel/empirical_cost, and Stage 3 does not use it.What
PlanSelectionSettings::measured_operation_costsholds the measured CPU ns for one update, merge or estimate per sketch configuration.SummaryAggandPaneChain), merges and estimates with an entry. Every other node keeps its formula price.NodeCost::price_sourcesaysmeasuredoranalytical.convert_rqe_atomic_coststurns sketch-bench's table into the measured table. Exact accumulators and Hydra rows are skipped, with the reason.stage_pipeline --measured-operation-costs <file>passes the table to Stage 3.(k − 1)·Imerges when ingestion needsk > 1cores, uses the state's measured merge too.CandidateCost::sourcesays whether a candidate's nodes were all priced from the formulas (COST_SOURCE), all measured (MEASURED_COST_SOURCE) or a mix (MIXED_COST_SOURCE).physical_plan_cost_model,empirical_cost,empirical_resourcesandResourceCalibration. This is a deliberate exception to "delete only when replaced". What they did beyond measured CPU (storage I/O, handoffs, cache profiles, per-node deployment evidence, provenance) is tracked in Plan selection: price storage I/O, handoffs and cache, from deployment evidence with provenance #733.storage_io,physical_handoff_costandquery_physical_loweringare kept for that issue.What the deleted legacy code did, and where it goes
physical_plan_cost_model.rsCostModeladapter pricing replacement candidates into one objectiveprice(), which already selects plans; no other callerPlannerPhysicalPlanProvider,PhysicalEvidenceSnapshot)query_physical_lowering.rskeptStorageIoProfile: disk reads/writes, object GETs/PUTs)storage_io.rskeptPhysicalHandoffProfile: network and materialization bytes)physical_handoff_cost.rskeptempirical_cost.rsmeasured_operation_costs(update, merge, estimate)SketchParamsequality; testlookup_ignores_the_kll_failure_probabilitymoved to Stage 3OfflineError)empirical_resources.rsmem_bytes_per_instanceExactResourceMeasurements)exact-*rowsanalytical_cost.rsResourceCalibration,ResourceEstimate::calibrated_costCostModel/ResourceUnitCost(existing)How
tns becomest · 10⁻⁶ / ms_per_cpu_opCPU operations ofResourceSpeed. Latency (operations ×ms_per_cpu_op) therefore equals the measured time, and all three cost models price it like any other operation.price()records each per-group sketch build'sSketchParams. Merges and estimates inherit them from their producer. A node is then matched to an entry by sketch and operation.(k − 1)·I× measured merge time, instead of one operation per merge.PlanSelectionSettings::validaterejects:InvalidCalibration);DuplicateMeasuredOperationCost, naming both);ms_per_cpu_op0 with a non-empty table (MeasuredCostsWithoutCpuSpeed).Key code interfaces added / modified
crates/asap-aware-mapping/src/stage3_plan_selection/measured_operation_costs.rs(new),crates/asap-aware-mapping/src/stage3_plan_selection.rscrates/asap-aware-mapping/src/analytical_cost.rs,crates/asap-aware-mapping/src/lib.rscrates/devtools/src/rqe_atomic_costs.rs(new),crates/devtools/src/bin/convert_rqe_atomic_costs.rs(new),crates/devtools/src/bin/stage_pipeline.rsCLI:
convert_rqe_atomic_costs <rqe_atomic_costs.json> <out.json>(new binary);stage_pipeline --measured-operation-costs <file>(new flag); theasap-stage-pipeline/v1document's per-node costs gain"price_source": "analytical" | "measured".Usage
stage3_plan_selectioninu1.json, compared with the same run without the flag:analytical; sourceCOST_SOURCEmeasured; sourceMIXED_COST_SOURCEBefore this PR
Stage 3 priced every sketch from its formulas. Measured sketch costs could only reach the legacy
PhysicalPlanCostModel, which plan selection does not call.After this PR
A deployment converts its sketch-bench measurements once and passes the table, in code or with
--measured-operation-costs. Stage 3 prices those sketches from it, so selection can change, and each node says where its price came from. With no table, every price and selection is unchanged. The only output change isprice_source: "analytical"on each node.Verification
cargo fmt --all -- --checkpasses.cargo clippy -p asap-aware-mapping -p asap-devtools --all-targets -- -D warningspasses.cargo nextest run -p asap-aware-mapping --lib -p asap-devtoolspasses 558/558, andcargo nextest run -p asap-devtools(with its integration tests) passes 39/39. The example 1 fixture was regenerated; its only change isprice_source: "analytical"on its 240 nodes.k > 1ingestion workers makes compaction 1,200× the one-operation compaction;failure_probability: Some(0.001)) matches a converter entry withNone, and anotherkdoes not;