HTTP benchmarking and workload simulation tool
251

http-loadgen is a high-throughput, configurable HTTP benchmarking and workload simulation tool.
Use it to load test any read/write API โ including permission systems like Ory Ketoโ .
./scripts/run.sh
This runs the default benchmark defined in config/config.yaml.
To run multiple configurations and generate a report:
./scripts/run.sh --benchmark
Results are written to:
benchmark_results.csv
Use this config:
# api/keto.yaml
api:
write_api: http://localhost:4467
read_api: http://localhost:4466
requests:
write:
method: PUT
url: "{{ .WriteAPI }}/admin/relation-tuples"
headers:
Content-Type: application/json
body: |
{
"namespace": "documents",
"object": "{{ .object }}",
"relation": "viewer",
"subject_id": "user:{{ .subject }}"
}
read:
method: POST
url: "{{ .ReadAPI }}/relation-tuples/check"
headers:
Content-Type: application/json
body: |
{
"namespace": "documents",
"object": "{{ .object }}",
"relation": "viewer",
"subject_id": "user:{{ .subject }}"
}
And run:
./http-loadgen --workload-config=./config/config.yaml --log-file=run.log
api/ # API-specific configurations (e.g., Keto)
config/ # Loadgen settings: concurrency, retries, durations
scripts/ # run.sh and benchmark automation
internal/ # Core logic: request engine, metrics, generator
cmd/ # CLI entrypoint (main.go)
| Flag | Description |
|---|---|
--duration-sec | Duration to run the test |
--concurrency | Number of concurrent workers |
--checks-per-second | Max read requests per second |
--read-ratio | Read to write ratio (e.g., 100 = 100:1) |
--workload-config | Path to YAML config file |
--log-file | Where to write logs |
--verbose | Enable detailed logging |
--max-retries | Retry attempts per request |
--retry-delay | Delay between retries (ms) |
--request-timeout | Timeout per HTTP request (sec) |
--max-open-conns | Max HTTP connections |
--max-idle-conns | Max idle connections |
--serve-metrics | Keep Prometheus metrics server alive |
--dry-run | Run logic without making real HTTP calls |
make build
When downloading the macOS binary (http-loadgen_darwin_arm64 or http-loadgen_darwin_amd64), macOS may block it with this error:
"http-loadgen" cannot be opened because the developer cannot be verified.
To fix it:
xattr -d com.apple.quarantine ./http-loadgen_darwin_arm64
chmod +x ./http-loadgen_darwin_arm64
./http-loadgen_darwin_arm64 --help
Alternatively, allow the app manually via:
๏ฃฟ System Settings โ Privacy & Security โ Allow Anyway
Build the image locally:
docker build -t http-loadgen:latest .
docker run --rm virag/http-loadgen:latest \
--workload-config=/app/config/config.yaml \
--log-file=/app/run.log
โ
This works out of the box because the default config is baked into the image at /app/config/config.yaml.
docker run --rm \
-v $(pwd)/config:/app/config \
virag/http-loadgen:latest \
--workload-config=/app/config/custom.yaml \
--log-file=/app/run.log
โ
This mounts your local config/ folder into the container, replacing the default.
docker run --rm virag/http-loadgen:latest \
--workload-config=/app/config/config.yaml \
--dry-run
Run with:
--serve-metrics
Then scrape:
http://localhost:2112/metrics
Prometheus-compatible metrics include:
retry_attempts_totalretry_success_totalpermission_check_totalretry_duration_secondsThis tool mimics real-world client behavior โ it:
Not just the raw DB underneath.
Content type
Image
Digest
sha256:ac8657f85โฆ
Size
11.8 MB
Last updated
about 1 year ago
docker pull virag/http-loadgen