Skip to content

Commit 01f710f

Browse files
docs(operations): add guide for trying asap-planner on SQL workloads
1 parent 6016eb2 commit 01f710f

2 files changed

Lines changed: 86 additions & 0 deletions

File tree

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Try asap-planner on a SQL Workload
2+
3+
Check whether your SQL workload is amenable to ASAPQuery acceleration by running just the
4+
planner.
5+
6+
## 1. Build
7+
8+
```bash
9+
cargo build --release -p asap_planner
10+
```
11+
12+
This only compiles `asap-planner-rs` and its small internal deps — not the full query engine.
13+
14+
## 2. Write a workload config
15+
16+
```yaml
17+
# sql_workload.yaml
18+
tables:
19+
- name: metrics_table
20+
time_column: time
21+
value_columns: [cpu_usage]
22+
metadata_columns: [hostname, datacenter, region]
23+
query_groups:
24+
- id: 1
25+
repetition_delay: 300 # seconds between repeats of this query
26+
controller_options:
27+
accuracy_sla: 0.95
28+
latency_sla: 100.0
29+
queries:
30+
- >-
31+
SELECT avg(cpu_usage) FROM metrics_table
32+
WHERE time BETWEEN DATEADD(s, -300, NOW()) AND NOW()
33+
GROUP BY datacenter
34+
aggregate_cleanup:
35+
policy: read_based
36+
```
37+
38+
List each recurring query your application actually runs, with its real repeat interval.
39+
40+
### Column fields
41+
42+
For each table:
43+
- `time_column` — the column your queries filter/bucket on (e.g. in a `WHERE time BETWEEN ...` clause).
44+
- `value_columns` — the numeric columns being aggregated (e.g. the column passed to `avg()`, `sum()`, etc.).
45+
- `metadata_columns` — every other column your queries `GROUP BY` or filter on (dimensions like `hostname`, `datacenter`, `region`). List all of them, not just the ones used in these queries' `GROUP BY`. The planner uses the full set to figure out which dimensions to roll up vs. keep grouped.
46+
47+
### `controller_options`
48+
49+
`accuracy_sla` and `latency_sla` are required by the config schema but not currently used by
50+
the planner's decision logic — any numeric values are fine (e.g. the placeholders in the
51+
example above).
52+
53+
### Choosing `repetition_delay` and `--data-ingestion-interval`
54+
55+
- `--data-ingestion-interval` is how often new rows actually land in the table (your ingestion
56+
cadence) — e.g. `15` if a new batch/row arrives every 15 seconds.
57+
- `repetition_delay` is how often this specific query actually re-runs in your application —
58+
e.g. `300` for a dashboard panel that refreshes every 5 minutes.
59+
- **Constraint:** `repetition_delay` must be an exact multiple of `--data-ingestion-interval`,
60+
or the planner errors out.
61+
62+
## 3. Run the planner
63+
64+
```bash
65+
asap-planner --query-language sql \
66+
--input_config sql_workload.yaml \
67+
--output_dir ./out \
68+
--data-ingestion-interval 15 \
69+
--streaming_engine precompute \
70+
-v
71+
```
72+
73+
- `--data-ingestion-interval` is the expected data ingestion cadence in seconds (required for SQL mode).
74+
- `--streaming_engine` just needs a valid value (`precompute`, `arroyo`, or `flink`) — none are actually started.
75+
- `-v` logs which queries were skipped and why.
76+
77+
## 4. Read the result
78+
79+
The planner writes `streaming_config.yaml` and `inference_config.yaml` to `./out`.
80+
81+
- Queries that show up there as aggregations are ones ASAPQuery can accelerate.
82+
- Queries silently skipped (visible with `-v`) are not currently supported — e.g. unsupported
83+
SQL shapes or queries with no inferable repeat pattern.
84+
85+
If most of your workload appears in `streaming_config.yaml`, ASAPQuery is likely a good fit.

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Task-oriented guides for common operations:
3838
### Operations Tasks
3939
- [Manual Stack Run for Prometheus](03-how-to-guides/operations/manual-stack-run-prometheus.md) - Run ASAP components manually to accelerate Prometheus
4040
- [Bootstrap Config from Query Log](03-how-to-guides/operations/bootstrap-config-from-query-log.md) - Auto-generate sketch configs from Prometheus query traffic
41+
- [Try asap-planner on a SQL Workload](03-how-to-guides/operations/try-asap-planner-sql.md) - Check SQL workload amenability without running the full stack
4142
- [Manual Stack Run for Clickhouse](03-how-to-guides/operations/manual-stack-run-clickhouse.md) - Run ASAP components manually to accelerate Clickhouse
4243
- [Deploy to CloudLab](03-how-to-guides/operations/deploy-cloudlab.md) - Deployment guide
4344
- [Troubleshooting](03-how-to-guides/operations/troubleshooting.md) - Common issues & solutions

0 commit comments

Comments
 (0)