xburner is an experimental HTTP and gRPC load generator written in Zig.
xburner README.md
10 kB · 341 lines
Markdown
at main

xburner #

xburner is an experimental HTTP and gRPC load generator written in Zig.

It supports two execution styles:

  • simple mode: a host-defined HTTP scenario driven directly from config
  • workflow mode: a Wasm guest defines the request/response state machine

The current workflow runtime defaults to WAMR. wasm3 is still kept in the repository as a comparison backend and for runtime experiments.

Status #

The project is usable for local development and end-to-end validation, but it is still under active development. The public interface is stabilizing, while runtime internals and platform support are still moving.

Highlights #

  • xburner validate <config>
  • xburner validate --dry-run <config>
  • xburner validate --with-setup <config>
  • xburner run <config>
  • HTTP/1.1 transport
  • opt-in HTTP/2 transport for HTTPS targets via http.version = "auto" or http.version = "2"
  • gRPC unary transport over HTTP/2/TLS
  • host-managed cookie jar with cookie_jar_scope = "vu" or cookie_jar_scope = "iteration"
  • custom TLS options for HTTPS targets: ca_file, server_name, insecure_skip_verify
  • request-level defaults in [http.defaults] for headers, timeouts, capture, and response-body handling
  • separate connect_timeout_ms and timeout_ms controls for manual transport paths
  • guest setup / teardown hooks with shared setup.* distribution
  • ramping-vus in addition to constant-vus and constant-arrival-rate
  • OTLP/HTTP metric export via OpenTelemetry
  • setup requests and threshold evaluation
  • built-in request checks for status code, body substring, and response header presence
  • machine-readable JSON probe output for --dry-run and --with-setup
  • machine-readable JSON summary output for run
  • workflow recovery with script_timeout and max_poisoned_workers
  • fixed-size latency histograms for percentile reporting during long runs

Requirements #

The local setup flow is currently maintained for macOS and Linux.

  • macOS
  • Linux
  • Zig 0.15.2
  • Git
  • Go
  • CMake
  • a working C/C++ toolchain
  • Homebrew grpc
  • Homebrew pkgconf

Setup #

third_party is intentionally not committed. Use the init script before building:

sh scripts/init.sh

What the script does:

  • clones wasm3 from main
  • clones wamr at a pinned revision
  • clones zig-o11y/opentelemetry-sdk at pinned upstream commit e92f7652e5c639d52c8be3b6836429dfefaaed6d
  • prepares the local third_party/ tree used by the build

The WAMR helper build is cached under .zig-cache/wamr-build and rebuilt incrementally when the local WAMR source tree changes. The workflow sample guest can also be rebuilt on demand with scripts/build_workflow_sample_wasm.sh. The gRPC transport backend links against the system C++ gRPC package and expects:

brew install grpc pkgconf go

Install #

See:

Licensing #

The repository's original source is currently distributed under the terms in LICENSE. Third-party runtime dependencies are documented in NOTICE and licenses.

Build And Test #

zig build test

On Linux, use the wrapper that builds the gRPC shim with the system compiler:

sh scripts/build_linux.sh
sh scripts/test_linux_unit.sh

On Linux and in Ubuntu CI reproduction, use:

sh scripts/test_linux_unit.sh

To reproduce the Ubuntu CI toolchain locally with Docker:

sh hacks/test_ubuntu_docker.sh

To force the same linux/amd64 userspace as CI:

sh hacks/test_ubuntu_docker.sh --platform linux/amd64

More testing details:

Release process details:

CLI #

zig build run -- --version
zig build run -- version
zig build run -- validate <config>
zig build run -- validate --dry-run <config>
zig build run -- validate --with-setup <config>
zig build run -- validate --wasm-backend wasm3 <config>
zig build run -- run <config>
zig build run -- run --wasm-backend wamr <config>

Behavior:

  • --version and version print the build version
  • validate checks config syntax, schema, and workflow ABI/exports
  • validate --dry-run emits a JSON probe instead of executing the full run
  • validate --with-setup executes setup.requests and emits a JSON probe
  • run writes progress to stderr and a final JSON summary to stdout

JSON output contract:

  • probe output includes schema_version, kind, scenario_mode, wasm_backend, setup_requests, and measured_requests
  • run summary includes schema_version, scenario_name, scenario_mode, wasm_backend, interrupted, measured, warmup, and thresholds_failed
  • arrival-rate windows also report scheduler lag metrics in the summary
  • measured.request_summaries and warmup.request_summaries include per-request aggregates for named request templates
  • transport timeouts are reported separately from other transport errors in both window summaries and request summaries
  • current versions: probe schema 1, summary schema 2

More output details:

Configuration #

See:

Config files may also use include = "./common.toml" and env_file = "./.env" to share fragments and environment values before parsing.

Workflow ABI #

Workflow guests are expected to export:

  • get_abi_version
  • init
  • start_iteration
  • next_request
  • handle_response

Host functions are available in the env, host, and xburner namespaces:

  • host_rand_u64
  • host_now_nanos
  • host_log
  • host_get_var
  • host_set_var
  • host_get_response_header
  • host_check_abort

See samples/workflow-health.c for a minimal guest example.

More workflow guest details:

Samples #

Simple Mode #

The repository includes a simple sample config at samples/simple-healthcheck.toml.

This sample expects a local service at http://127.0.0.1:18080/health.

Example commands:

python3 hacks/simple_fixture_server.py

zig build run -- validate samples/simple-healthcheck.toml
zig build run -- validate --dry-run samples/simple-healthcheck.toml
zig build run -- run samples/simple-healthcheck.toml

For unary gRPC, see samples/simple-grpc-echo.toml. It targets the local fixture server from hacks/grpc_fixture_server.go. You can run both gRPC samples with:

sh scripts/test_samples.sh grpc

Distributed Mode #

For a coordinator / agent sample, see samples/distributed-healthcheck.toml.

This sample uses the same local fixture server as the simple HTTP sample.

Example flow:

python3 hacks/simple_fixture_server.py

In two other shells, start agents:

zig build run -- agent --listen 127.0.0.1:19091
zig build run -- agent --listen 127.0.0.1:19092

Then run the coordinator:

zig build run -- run-distributed \
  --agent 127.0.0.1:19091 \
  --agent 127.0.0.1:19092 \
  samples/distributed-healthcheck.toml

Plugin Exporter #

For a sample exporter plugin config, see samples/plugin-csv-healthcheck.toml.

This writes a CSV summary row to /tmp/xburner-plugin-sample.csv using the sample plugin in samples/plugins/csv. Run it from the repository root so the relative plugins.dir resolves correctly.

python3 hacks/simple_fixture_server.py
zig build run -- run samples/plugin-csv-healthcheck.toml
cat /tmp/xburner-plugin-sample.csv

Workflow Mode #

The workflow sample lives in:

The sample guest can be compiled with:

sh scripts/build_workflow_sample_wasm.sh

This sample expects a local service at:

  • http://127.0.0.1:18082/login
  • http://127.0.0.1:18082/me

You can start the local workflow sample server with:

python3 hacks/workflow_fixture_server.py

The sample config uses a relative Wasm path, so either:

  • run xburner from the samples/ directory, or
  • replace the Wasm path with an absolute path before running it

One workable flow is:

python3 ../hacks/workflow_fixture_server.py

In a second shell:

zig build
cd samples
../zig-out/bin/xburner validate workflow-health.toml
../zig-out/bin/xburner run workflow-health.toml

To run the same workflow on the comparison backend, add this line to the sample config:

wasm_backend = "wasm3"

Validation Scripts #

See:

Current Limitations #

  • The local setup and CI flow currently target macOS and Linux only.
  • gRPC support is currently unary-only.
  • validate --dry-run and validate --with-setup are probes, not full execution.
  • The workflow runtime defaults to WAMR, while wasm3 remains in-tree as a comparison backend.
  • Relative plugin paths are resolved from the current working directory, not the config file location.
  • third_party/ is local state produced by scripts/init.sh; it is not part of the committed repository.

Repository Notes #

Important local paths: