Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
5cddc74
test(cost): failing tests for a deployment's measured scan series, na…
zzylol Dec 3, 2026
1c6e069
test(planner): failing end-to-end tests for planning with a deploymen…
zzylol Dec 3, 2026
4bc4c47
feat(cost): a measured scan entry charges each series the scan visits…
zzylol Dec 3, 2026
81a422c
feat(cost): name the scan and filter charges and price predicates per…
zzylol Dec 3, 2026
6199be9
feat(cost): price the raw rows query-time scans keep where the data p…
zzylol Dec 3, 2026
d45b1f3
feat(cost): a chain's window holds, emits and keeps states only for t…
zzylol Dec 3, 2026
bd80459
feat(calibration): a deployment's measured cost files for two machines
zzylol Dec 3, 2026
3b30201
test: re-pin the anchors items 3 and 5 move
zzylol Dec 3, 2026
cfa34fb
fix(calibration): price a query-time chain from the measured cost fil…
zzylol Dec 3, 2026
d861da2
style: list every payload in the series-visited match; format the e2e…
zzylol Dec 3, 2026
d75dc48
test(snapshots): regenerate the 10 corpus and 5 sketch plan snapshots…
zzylol Dec 3, 2026
dd23c8c
fix(cost): restack onto IN-list selectivity: a query-time scan visits…
zzylol Dec 3, 2026
66e8c99
fix(cost): review I1-I4 and item 6: how a window's rows reach groups,…
zzylol Dec 3, 2026
f403938
fix(cost): readers read every group per window (merge prices were fit…
zzylol Dec 3, 2026
bff8c06
fix(cost): reach from the chain's own key columns; window merges reac…
zzylol Dec 4, 2026
b64df3f
test(snapshots): regenerate the sketch plan snapshots after I1 (perio…
zzylol Dec 4, 2026
d33a9ba
test(planner): assert kept state for the dependents and full < on-dem…
zzylol Dec 4, 2026
56de06d
test(planner): compare T3's upkeep with the state the measured runs kept
zzylol Dec 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions calibration/measured-cost-files/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Measured cost files

Each file is a deployment's measured cost file: a `CostInputs` JSON
(`asap_planner --cost-inputs <file>`, or `PlanningModels::with_cost_inputs`).
It holds what the deployment's data plane measured on one machine. The file
name is the machine key: CPU architecture, CPU model, logical cores and memory
type. Hostnames are never used.

`x86_64-intel-xeon-e5-2683-v3-56t-registered-ddr4.json` was fitted on 2026-12-03
from one data plane's runs of three SIL intents (`drill_cnt`, `dash`, `rca`).
There were 60 rounds each, all three planning modes, and two repetitions. Times are
CPU ns of the data plane's threads:

| entry | value | fitted from |
|---|---|---|
| `Scan` at query time | 41 ns per row read, 8,700 ns per series visited | four filtered raw reads (residuals 0.85-1.15); held out: 1.01, 1.36 |
| `TimeRange` at query time | 0 | inside the scan's per-row time |
| `Scan` at ingestion time | 150 ns per arriving row | chain upkeep of four chains, one and two label columns (85-305 ns per row with the update) |
| chain update (exact; DDSketch 116), at ingestion and in a query-time chain | 55 ns per row | the same fit |
| state emitted at a window close, persist included | 3,900 ns (charged as the formula's emit plus `ns_per_state_emitted`: 2,400 exact, 1,400 DDSketch) | the same fit |
| `SummaryMergeWindows` (exact) | 780 ns per narrower state merged (about 3,900 per state it emits) | the same fit |
| `SummaryMerge` at query time | 200 ns per exact state, 1,200 per DDSketch state, all-in | three merges of 92k-1M states (0.75-1.25) |
| `FinalizeExactAccumulator` | 300 ns per group | the same merges |
| `SummaryEstimate` (DDSketch) | 3,700 ns per group | the executor fit |
| memory per exact state | 48 bytes | the (host, user) chain's resident views |
| raw rows | kept in memory, 32 bytes per row | the raw store's bytes over rows held |
| `ns_per_ingested_sample` | 460 ns (decode 230, append 230) | per-phase CPU counters |

The view window cache mirrors the data plane's configuration: 60 s idle and
15-minute files.

`x86_64-intel-xeon-e5-2660-v2-40t-unknown-memory.json` is the same table for a
second machine. On it, the same plans took 1.22-1.28x as long in every operator
class: raw read, merge, and chain upkeep. So every measured time is 1.25x, and
the formula-priced nodes are scaled 1.25x (`frozen_calibration_factor`).

A file is refitted by measuring the data plane again on that machine. The
planner reads only the file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
"frozen_calibration_factor": 1.25,
"data_plane_execution": {
"view_window_cache": {
"idle_ms": 60000,
"file_span_ms": 900000
},
"raw_data_medium": "Memory",
"raw_data_bytes_per_row": 32.0
},
"measured_operation_costs": {
"ns_per_ingested_sample": 575.0,
"operators": [
{
"operator": "Scan",
"phase": "query_time",
"ns_per_unit": 51.25,
"ns_per_series": 10875.0
},
{
"operator": "TimeRange",
"phase": "query_time",
"ns_per_unit": 0.0
},
{
"operator": "Scan",
"phase": "ingestion_time",
"ns_per_unit": 187.5
},
{
"operator": "SummaryTumblingWindowChain",
"phase": "ingestion_time",
"exact": "Count",
"ns_per_unit": 68.75,
"ns_per_state_emitted": 3000.0,
"memory_bytes_per_state": 48.0
},
{
"operator": "SummaryTumblingWindowChain",
"phase": "ingestion_time",
"exact": "Max",
"ns_per_unit": 68.75,
"ns_per_state_emitted": 3000.0,
"memory_bytes_per_state": 48.0
},
{
"operator": "SummaryTumblingWindowChain",
"phase": "ingestion_time",
"sketch": {
"DDSketch": {
"alpha": 0.05
}
},
"ns_per_unit": 145.0,
"ns_per_state_emitted": 1750.0
},
{
"operator": "SummaryTumblingWindowChain",
"phase": "query_time",
"exact": "Count",
"ns_per_unit": 68.75
},
{
"operator": "SummaryTumblingWindowChain",
"phase": "query_time",
"exact": "Max",
"ns_per_unit": 68.75
},
{
"operator": "SummaryTumblingWindowChain",
"phase": "query_time",
"sketch": {
"DDSketch": {
"alpha": 0.05
}
},
"ns_per_unit": 145.0
},
{
"operator": "SummaryMergeWindows",
"phase": "ingestion_time",
"exact": "Count",
"ns_per_unit": 975.0
},
{
"operator": "SummaryMergeWindows",
"phase": "ingestion_time",
"exact": "Max",
"ns_per_unit": 975.0
},
{
"operator": "SummaryMergeWindows",
"phase": "ingestion_time",
"sketch": {
"DDSketch": {
"alpha": 0.05
}
},
"ns_per_unit": 1875.0
},
{
"operator": "SummaryMerge",
"phase": "query_time",
"exact": "Count",
"ns_per_unit": 250.0
},
{
"operator": "SummaryMerge",
"phase": "query_time",
"exact": "Max",
"ns_per_unit": 250.0
},
{
"operator": "SummaryMerge",
"phase": "query_time",
"sketch": {
"DDSketch": {
"alpha": 0.05
}
},
"ns_per_unit": 1500.0
},
{
"operator": "FinalizeExactAccumulator",
"phase": "query_time",
"exact": "Count",
"ns_per_unit": 375.0
},
{
"operator": "FinalizeExactAccumulator",
"phase": "query_time",
"exact": "Max",
"ns_per_unit": 375.0
},
{
"operator": "SummaryEstimate",
"phase": "query_time",
"sketch": {
"DDSketch": {
"alpha": 0.05
}
},
"ns_per_unit": 4625.0
},
{
"operator": "SummaryAgg",
"phase": "query_time",
"sketch": {
"DDSketch": {
"alpha": 0.05
}
},
"ns_per_unit": 145.0
}
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
"frozen_calibration_factor": 1.0,
"data_plane_execution": {
"view_window_cache": {
"idle_ms": 60000,
"file_span_ms": 900000
},
"raw_data_medium": "Memory",
"raw_data_bytes_per_row": 32.0
},
"measured_operation_costs": {
"ns_per_ingested_sample": 460.0,
"operators": [
{
"operator": "Scan",
"phase": "query_time",
"ns_per_unit": 41.0,
"ns_per_series": 8700.0
},
{
"operator": "TimeRange",
"phase": "query_time",
"ns_per_unit": 0.0
},
{
"operator": "Scan",
"phase": "ingestion_time",
"ns_per_unit": 150.0
},
{
"operator": "SummaryTumblingWindowChain",
"phase": "ingestion_time",
"exact": "Count",
"ns_per_unit": 55.0,
"ns_per_state_emitted": 2400.0,
"memory_bytes_per_state": 48.0
},
{
"operator": "SummaryTumblingWindowChain",
"phase": "ingestion_time",
"exact": "Max",
"ns_per_unit": 55.0,
"ns_per_state_emitted": 2400.0,
"memory_bytes_per_state": 48.0
},
{
"operator": "SummaryTumblingWindowChain",
"phase": "ingestion_time",
"sketch": {
"DDSketch": {
"alpha": 0.05
}
},
"ns_per_unit": 116.0,
"ns_per_state_emitted": 1400.0
},
{
"operator": "SummaryTumblingWindowChain",
"phase": "query_time",
"exact": "Count",
"ns_per_unit": 55.0
},
{
"operator": "SummaryTumblingWindowChain",
"phase": "query_time",
"exact": "Max",
"ns_per_unit": 55.0
},
{
"operator": "SummaryTumblingWindowChain",
"phase": "query_time",
"sketch": {
"DDSketch": {
"alpha": 0.05
}
},
"ns_per_unit": 116.0
},
{
"operator": "SummaryMergeWindows",
"phase": "ingestion_time",
"exact": "Count",
"ns_per_unit": 780.0
},
{
"operator": "SummaryMergeWindows",
"phase": "ingestion_time",
"exact": "Max",
"ns_per_unit": 780.0
},
{
"operator": "SummaryMergeWindows",
"phase": "ingestion_time",
"sketch": {
"DDSketch": {
"alpha": 0.05
}
},
"ns_per_unit": 1500.0
},
{
"operator": "SummaryMerge",
"phase": "query_time",
"exact": "Count",
"ns_per_unit": 200.0
},
{
"operator": "SummaryMerge",
"phase": "query_time",
"exact": "Max",
"ns_per_unit": 200.0
},
{
"operator": "SummaryMerge",
"phase": "query_time",
"sketch": {
"DDSketch": {
"alpha": 0.05
}
},
"ns_per_unit": 1200.0
},
{
"operator": "FinalizeExactAccumulator",
"phase": "query_time",
"exact": "Count",
"ns_per_unit": 300.0
},
{
"operator": "FinalizeExactAccumulator",
"phase": "query_time",
"exact": "Max",
"ns_per_unit": 300.0
},
{
"operator": "SummaryEstimate",
"phase": "query_time",
"sketch": {
"DDSketch": {
"alpha": 0.05
}
},
"ns_per_unit": 3700.0
},
{
"operator": "SummaryAgg",
"phase": "query_time",
"sketch": {
"DDSketch": {
"alpha": 0.05
}
},
"ns_per_unit": 116.0
}
]
}
}
8 changes: 4 additions & 4 deletions crates/cost/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
//! with the same function and the rules `plan_cost` applies:
//! [`plan::execution_demand::executions_per_second`],
//! `RefreshWindow::computed_from` (an ingestion-time node's window), [`read_back_ms`],
//! [`raw_data_disk_cost_per_second`] and
//! [`raw_data_cost_per_second`] and
//! [`request_overhead_cost_per_second`].
mod measured;
mod model;
Expand Down Expand Up @@ -50,8 +50,8 @@ pub use node::usage::{
};
pub use plan::cost::{
close_together, ingest_decode_cpu_core_seconds_per_second, ingest_threads_building_copies,
partial_copy_merge_ms, plan_cost, raw_data_disk_cost_per_second, refresh_queue,
request_fixed_cost, request_overhead_cost_per_second, requests_per_second, PlanCost,
QueryLatency, RecommendedThreads, RequestFixedCost, RoleThreads,
partial_copy_merge_ms, plan_cost, raw_data_cost_per_second, refresh_queue, request_fixed_cost,
request_overhead_cost_per_second, requests_per_second, PlanCost, QueryLatency,
RecommendedThreads, RequestFixedCost, RoleThreads,
};
pub use resources::ResourceUsage;
Loading