Skip to main content

crabka_bench_driver/
lib.rs

1// Benchmark drivers do a lot of `as u64` on Unix nanos / millis where
2// precision loss past i64::MAX is irrelevant; silence pedantic casts
3// at the crate root rather than at each call site. Likewise,
4// `format!(...)` appended to a building Markdown string reads more
5// linearly than the equivalent `write!(out, ...).unwrap()` chain, and
6// the orchestrator function in `workload::run` is intentionally one
7// long top-to-bottom narrative.
8#![allow(
9    clippy::cast_sign_loss,
10    clippy::cast_possible_truncation,
11    clippy::cast_precision_loss,
12    clippy::cast_possible_wrap,
13    clippy::similar_names,
14    clippy::format_push_string,
15    clippy::too_many_lines
16)]
17
18//! Load driver + report aggregator for the Crabka vs Strimzi benchmark
19//! harness on Kubernetes.
20//!
21//! Scenarios describe a target Kafka stack, a workload shape, and optional
22//! disturbance windows. The driver applies the scenario to Kubernetes, runs
23//! the producer/consumer load, samples Prometheus, and writes a `RunOutput`
24//! JSON artifact. The report binary reads those artifacts back and renders
25//! the side-by-side Markdown summary used in benchmark reports.
26//!
27//! The crate ships two binaries:
28//!
29//! - `crabka-bench-driver` — runs one scenario against one Kafka stack
30//!   (Crabka or Strimzi/Kafka), captures throughput / latency / disturbance
31//!   data, queries Prometheus for resource usage, and writes a single
32//!   `RunOutput` JSON file.
33//! - `crabka-bench-report` — walks a directory of `RunOutput` files,
34//!   groups them by scenario name, and emits a side-by-side Markdown
35//!   summary.
36//!
37//! ## Command-line workflow
38//!
39//! ```text
40//! crabka-bench-driver \
41//!   --scenario bench/scenarios/steady_1p1r.toml \
42//!   --stack crabka \
43//!   --namespace kafka-bench \
44//!   --out runs/crabka-steady.json
45//!
46//! crabka-bench-report --input runs --out report.md
47//! ```
48//!
49//! ## Programmatic report aggregation
50//!
51//! ```no_run
52//! use crabka_bench_driver::report;
53//! use std::path::Path;
54//!
55//! # fn run() -> Result<(), Box<dyn std::error::Error>> {
56//! let markdown = report::render_markdown(Path::new("runs"), true)?;
57//! std::fs::write("report.md", markdown)?;
58//! # Ok(())
59//! # }
60//! ```
61
62pub mod failover;
63pub mod hist;
64pub mod payload;
65pub mod prom;
66pub mod rate;
67pub mod report;
68pub mod scenario;
69pub mod workload;