1.6 KiB
1.6 KiB
k6 Load Testing
Reproducible load test profile for POST /api/v1/decide.
Prerequisites
- Docker + Docker Compose
jq- Running stack (
docker compose -f compose.yaml up -d)
One-command run
./infrastructure/k6/run-decide.sh
This command:
- Prepares deterministic fixture via
prepare_k6_fixture. - Runs
grafana/k6in a pinned container image. - Saves artifacts to
artifacts/k6/<RUN_ID>/.
Artifacts:
fixture.jsonrun.envsummary.json
Reproducible rerun
Use the same RUN_ID and k6 profile parameters.
RUN_ID=baseline_20260224 \
START_RPS=20 \
RAMP_UP_RPS=200 \
HOLD_RPS=200 \
HOLD_DURATION=2m \
./infrastructure/k6/run-decide.sh
Target URL
Default target for k6 container:
K6_BASE_URL=http://host.docker.internal
Override if needed:
K6_BASE_URL=http://host.docker.internal:14609 ./infrastructure/k6/run-decide.sh
Profile knobs
START_RPSRAMP_UP_RPSHOLD_RPSRAMP_UP_DURATIONHOLD_DURATIONRAMP_DOWN_DURATIONPRE_ALLOCATED_VUSMAX_VUSTHRESHOLD_ERROR_RATETHRESHOLD_P95_MSTHRESHOLD_P99_MSK6_IMAGE
Compare two runs
BASE=artifacts/k6/baseline_20260224/summary.json
CAND=artifacts/k6/candidate_20260224/summary.json
jq -n --argfile b "$BASE" --argfile c "$CAND" '{
baseline_p95_ms: $b.metrics.http_req_duration["p(95)"],
candidate_p95_ms: $c.metrics.http_req_duration["p(95)"],
baseline_req_per_s: $b.metrics.http_reqs.rate,
candidate_req_per_s: $c.metrics.http_reqs.rate,
baseline_error_rate: $b.metrics.http_req_failed.value,
candidate_error_rate: $c.metrics.http_req_failed.value
}'