Skip to main content

Crate crabka_bench_driver

Crate crabka_bench_driver 

Source
Expand description

Load driver + report aggregator for the Crabka vs Strimzi benchmark harness on Kubernetes.

Scenarios describe a target Kafka stack, a workload shape, and optional disturbance windows. The driver applies the scenario to Kubernetes, runs the producer/consumer load, samples Prometheus, and writes a RunOutput JSON artifact. The report binary reads those artifacts back and renders the side-by-side Markdown summary used in benchmark reports.

The crate ships two binaries:

  • crabka-bench-driver — runs one scenario against one Kafka stack (Crabka or Strimzi/Kafka), captures throughput / latency / disturbance data, queries Prometheus for resource usage, and writes a single RunOutput JSON file.
  • crabka-bench-report — walks a directory of RunOutput files, groups them by scenario name, and emits a side-by-side Markdown summary.

§Command-line workflow

crabka-bench-driver \
  --scenario bench/scenarios/steady_1p1r.toml \
  --stack crabka \
  --namespace kafka-bench \
  --out runs/crabka-steady.json

crabka-bench-report --input runs --out report.md

§Programmatic report aggregation

use crabka_bench_driver::report;
use std::path::Path;

let markdown = report::render_markdown(Path::new("runs"), true)?;
std::fs::write("report.md", markdown)?;

Modules§

failover
Kill-broker orchestration for the failover scenario. Uses the in-cluster kube API via the Job’s ServiceAccount — the ServiceAccount needs pods: get,list,delete in the target namespace, and is only mounted when a failover scenario actually requests it.
hist
HDR histogram helpers. Latencies are recorded in microseconds with (min=1us, max=60s, sigfig=3) — plenty of resolution from sub-ms up to degraded-broker timeouts, without blowing memory.
payload
Record-payload generator. The first 24 bytes of every produced record are reserved for (magic_be, scenario_id_be, send_unix_nanos_be) so consumers can compute end-to-end latency by re-reading the embedded send_unix_nanos. The remaining bytes are a deterministic filler so the wire size is exactly msg_size_bytes.
prom
Prometheus query client. The driver issues a small set of instant queries at scenario end to capture resource usage on the broker pods and (Strimzi only) JVM heap / non-heap from the JMX exporter.
rate
Token-bucket pacer for FixedRate scenarios. saturate mode never calls this — it just awaits the producer’s natural backpressure.
report
Aggregate per-run JSON outputs into a single Markdown summary.
scenario
Scenario is the on-disk YAML schema the driver reads; RunOutput is the on-disk JSON schema the driver writes. The report aggregator reads RunOutput documents and emits Markdown.
workload
Producer + consumer workload runners. Builds N producers and M consumers (members of one group), runs warmup → measurement phases, optionally triggers a failover mid-measurement, and merges per-task histograms into the public LatencyPercentiles shape.