Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
33 changes: 33 additions & 0 deletions scripts/leaderboard-catalog-clickbench.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"catalog_version": 1,
"systems": {
"postgresql": {
"name": "TimescaleDB",
"description": "PostgreSQL with the timescaledb extension, set up as ClickBench's timescaledb entry: hits is a compressed hypertable; timescaledb_toolkit is installed."
}
},
"configurations": {
"clickhouse/exact": {
"name": "Exact",
"description": "ClickBench's ClickHouse queries, as written; exact answers."
},
"duckdb/exact": {
"name": "Exact",
"description": "ClickBench's DuckDB queries, as written; exact answers."
},
"postgresql/exact": {
"name": "Exact",
"description": "ClickBench's timescaledb queries, as written; exact answers."
},
"postgresql/approximate": {
"name": "approx_count_distinct rewrite",
"description": "ASAPBench's rewrite, not part of ClickBench: each query with COUNT(DISTINCT x) uses timescaledb_toolkit's distinct_count(approx_count_distinct(x)) instead (HyperLogLog++ at the toolkit's default size), computed from the stored rows at every query. Queries without COUNT(DISTINCT) are not run."
}
},
"workloads": {
"clickbench-hits": {
"name": "ClickBench hits",
"description": "ClickBench's 43 queries over its hits table of web analytics events, each system in its own dialect from the ClickBench repository."
}
}
}
53 changes: 53 additions & 0 deletions scripts/leaderboard-catalog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"catalog_version": 1,
"benchmarks": {
"one-shot": {
"name": "One-shot SQL",
"description": "Each query runs on its own over a loaded table; hot runs are timed and answers are compared with the truth configuration."
},
"periodic": {
"name": "Periodic PromQL",
"description": "Samples are written as time series and every query is evaluated again at each step of its interval, as dashboards and alerts do."
}
},
"systems": {
"clickhouse": { "name": "ClickHouse", "description": "ClickHouse server, queried over HTTP." },
"duckdb": { "name": "DuckDB", "description": "DuckDB command line on a database file." },
"postgresql": { "name": "PostgreSQL", "description": "PostgreSQL, queried with psql." },
"druid": { "name": "Apache Druid", "description": "Apache Druid, queried with Druid SQL over HTTP." },
"pilotdb": {
"name": "PilotDB",
"description": "PilotDB on DuckDB: sampling-based approximate query processing with an error guarantee set before the query runs."
},
"VictoriaMetrics": {
"name": "VictoriaMetrics",
"description": "VictoriaMetrics single node: stores every raw sample and answers each query at query time."
},
"ASAPQuery-backend": {
"name": "ASAPQuery-backend",
"description": "ASAPQuery's control plane plans the queries with ASAPPlanner; its data plane keeps what the plan needs (summaries, materialized views, raw samples when allowed) and answers from it."
}
},
"configurations": {
"*/exact": { "name": "Exact", "description": "Every query as written; exact answers." },
"druid/exact": {
"name": "Exact",
"description": "useApproximateCountDistinct and useApproximateTopN off: COUNT(DISTINCT) and TopN answered exactly."
},
"druid/defaults": {
"name": "Druid defaults",
"description": "Druid's default query context, which answers COUNT(DISTINCT) approximately (useApproximateCountDistinct) and uses approximate TopN (useApproximateTopN)."
},
"pilotdb/*": {
"name": "PilotDB, relative error {relative_error}",
"description": "Target relative error {relative_error} with failure probability {failure_probability}; only the queries PilotDB's paper runs."
}
},
"workloads": {
"ddos_syn_flood": { "name": "DDoS SYN flood", "description": "Use case 1: SYN flood alerts from distinct source IPs and their entropy over short windows." },
"k8s_autoscaling": { "name": "Kubernetes autoscaling", "description": "Use case 2: scale-out, scale-in and resize decisions from CPU and memory percentiles of containers." },
"video_experience": { "name": "Video experience", "description": "Use case 3: video quality alerts from buffering, bitrate and start time." },
"canary_release": { "name": "Canary release", "description": "Use case 4: promote or roll back a canary from its latency percentiles." },
"top_clients": { "name": "Top clients", "description": "Use case 5: rate limiting of the top clients by request count." }
}
}
43 changes: 33 additions & 10 deletions scripts/leaderboard-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,30 @@ Pack saved benchmark results into one archive, and show an archive as the system
or as Grafana dashboards, without running any system again.

scripts/leaderboard-data.sh pack <archive.tar.xz> [--one-shot <run-directory>]...
[--use-cases <runs-directory>]
[--use-cases <runs-directory>] [--spec <summary.json>]...
scripts/leaderboard-data.sh web <archive.tar.xz | data-directory> [<port>]
scripts/leaderboard-data.sh grafana <archive.tar.xz | data-directory>

pack --one-shot a run directory of scripts/one-shot-workload.sh after one-shot-report;
its reports, results/ and workloads/ are kept, a DuckDB database is not
--use-cases the runs/ directory scripts/use_cases/run_use_case_on_systems.py writes
under its --data, holding index.json
web unpacks the archive under target/leaderboard-data/, writes
system-leaderboard/public/data/all.jsonl from it and starts the leaderboard
[port 5173]; needs python3 and node 20.19 or later
--spec an <arm>-summary.json of run_use_case_on_systems.py --spec, kept with
the leaderboard.json of its directory
web unpacks the archive under target/leaderboard-data/, writes all.jsonl, catalog.json
and sources.json into system-leaderboard/public/data/ from it and starts the
leaderboard [port 5173]; needs python3 and node 20.19 or later. Results that must
not be published are opened in the page itself (Open local results), not packed.
grafana unpacks the archive under target/leaderboard-data/, writes leaderboard/records.json
in it and starts tools/grafana/run.sh on it: the five use cases on systems and the
one-shot query dashboards

An archive holds one directory:
manifest.json when, from which ASAPBench commit, on which machine
one-shot/<run>/ one-shot-summary.csv, one-shot-tables.csv, results/, workloads/
one-shot/<run>/ one-shot-summary.csv, one-shot-tables.csv, results/, workloads/,
leaderboard.json
phase3/runs/ index.json and one directory per use-case run
spec/<directory>/ <arm>-summary.json files and leaderboard.json
EOF
}

Expand Down Expand Up @@ -64,15 +69,16 @@ case $action in
[ $# -ge 1 ] || { usage >&2; exit 2; }
archive=$(realpath -m "$1"); shift
case $archive in *.tar.xz) ;; *) echo "the archive name ends in .tar.xz" >&2; exit 2 ;; esac
one_shot=(); use_cases=""
one_shot=(); use_cases=""; spec=()
while [ $# -gt 0 ]; do
case $1 in
--one-shot) one_shot+=("$(realpath "$2")"); shift 2 ;;
--use-cases) use_cases=$(realpath "$2"); shift 2 ;;
--spec) spec+=("$(realpath "$2")"); shift 2 ;;
*) usage >&2; exit 2 ;;
esac
done
[ ${#one_shot[@]} -gt 0 ] || [ -n "$use_cases" ] || { echo "nothing to pack" >&2; exit 2; }
[ ${#one_shot[@]} -gt 0 ] || [ -n "$use_cases" ] || [ ${#spec[@]} -gt 0 ] || { echo "nothing to pack" >&2; exit 2; }
name=$(basename "$archive" .tar.xz)
staging=$(mktemp -d)
trap 'rm -rf "$staging"' EXIT
Expand All @@ -81,7 +87,7 @@ case $action in
[ -f "$run/one-shot-summary.csv" ] || { echo "$run has no one-shot-summary.csv; run one-shot-report first" >&2; exit 1; }
target=$staging/$name/one-shot/$(basename "$run")
mkdir -p "$target"
for item in one-shot-summary.csv one-shot-summary.md one-shot-tables.csv results workloads; do
for item in one-shot-summary.csv one-shot-summary.md one-shot-tables.csv results workloads leaderboard.json; do
[ -e "$run/$item" ] && cp -a "$run/$item" "$target/"
done
done
Expand All @@ -90,6 +96,15 @@ case $action in
mkdir -p "$staging/$name/phase3"
cp -a "$use_cases" "$staging/$name/phase3/runs"
fi
for summary in ${spec[@]+"${spec[@]}"}; do
case $summary in *-summary.json) ;; *) echo "$summary is not an <arm>-summary.json" >&2; exit 1 ;; esac
[ -f "$summary" ] || { echo "no $summary" >&2; exit 1; }
source_directory=$(dirname "$summary")
target=$staging/$name/spec/$(basename "$source_directory")
mkdir -p "$target"
cp -a "$summary" "$target/"
[ -f "$source_directory/leaderboard.json" ] && cp -a "$source_directory/leaderboard.json" "$target/"
done
python3 - "$staging/$name" "$repo" <<'PY'
import datetime, glob, json, os, subprocess, sys
root, repo = sys.argv[1:]
Expand All @@ -106,6 +121,7 @@ manifest = {
"machines": [json.loads(m) for m in sorted(machines)],
"one_shot_runs": sorted(os.listdir(os.path.join(root, "one-shot"))) if os.path.isdir(os.path.join(root, "one-shot")) else [],
"use_case_runs": os.path.isdir(os.path.join(root, "phase3", "runs")),
"spec_directories": sorted(os.listdir(os.path.join(root, "spec"))) if os.path.isdir(os.path.join(root, "spec")) else [],
}
with open(os.path.join(root, "manifest.json"), "w") as file:
json.dump(manifest, file, indent=2)
Expand All @@ -117,8 +133,15 @@ PY
web)
[ $# -ge 1 ] || { usage >&2; exit 2; }
data=$(data_directory "$1"); port=${2:-5173}
python3 "$repo/scripts/system-leaderboard-data.py" --data "$data" \
--output "$repo/system-leaderboard/public/data/all.jsonl"
public=$repo/system-leaderboard/public/data
python3 "$repo/scripts/system-leaderboard-data.py" --data "$data" --output "$public/all.jsonl"
python3 - "$public/sources.json" "$(basename "$data")" <<'PY'
import json, sys
path, name = sys.argv[1:]
with open(path, "w") as file:
json.dump({"title": "System Leaderboard",
"sources": [{"name": name, "records": "all.jsonl", "catalog": "catalog.json"}]}, file, indent=1)
PY
command -v npm >/dev/null || { echo "needs node 20.19 or later and npm" >&2; exit 1; }
cd "$repo/system-leaderboard"
[ -d node_modules ] || npm ci --no-audit --no-fund
Expand Down
Loading
Loading