k6 suites that assert the Hathor worldbuilding SLOs documented in
docs/performance/baselines.md §3.
| Script | Exercises | SLO gate |
|---|---|---|
world-load.js |
POST/GET /api/v1/worlds, /:id, /:id/export |
create p95 ≤ 400 ms, export p95 ≤ 2,000 ms |
narrative-load.js |
POST /api/quests |
quest create p95 ≤ 3,500 ms (LLM-backed) |
simulation-load.js |
POST /api/jobs, GET /api/jobs/:jobId (first-frame poll) |
enqueue p95 ≤ 500 ms, simulation first-frame p95 ≤ 1,500 ms |
Run locally#
bash
docker compose -f docker/docker-compose.dev.yml up -d
# World API — CRUD + export
k6 run testing/performance/k6/hathor/world-load.js
# Narrative API — quest creation (LLM)
k6 run testing/performance/k6/hathor/narrative-load.js
# Simulation worker — enqueue + first-frame latency
k6 run testing/performance/k6/hathor/simulation-load.js
Environment variables#
| Var | Default | Purpose |
|---|---|---|
HATHOR_WORLD_URL |
http://localhost:3600 |
world-api origin |
HATHOR_NARRATIVE_URL |
http://localhost:3601 |
narrative-api origin |
HATHOR_SIMULATION_URL |
http://localhost:3602 |
simulation-worker origin |
JWT_SECRET |
hathor-load-test-secret |
HS256 secret for load-test tokens |
HATHOR_EXPORT_RATIO |
0.25 |
Fraction of world iterations that run /export |
HATHOR_SIM_POLL_INTERVAL_MS |
50 |
First-frame poll cadence |
HATHOR_SIM_FIRST_FRAME_MAX_WAIT_MS |
8000 |
Abort a simulation iteration after this wait |
HATHOR_WORLD_SEED_ID |
unset | Pre-seeded world id to use instead of ad-hoc |
What counts as a regression#
A run regresses the Hathor SLO if any thresholds block in the scripts fails —
k6 exits non-zero. The numeric budgets match the per-domain section in
docs/performance/baselines.md; a budget change requires updating both.
What the tests deliberately don't cover#
- Merge-request workflows (low traffic in practice — covered by contract tests).
- Version snapshot/restore loops (storage-bound, tracked separately).
- Dialog generation (covered under Isis voice-synthesis tests).