Load test: Sample.Blazor infer endpoint
Short load test for POST /api/intent/infer (Sample.Blazor) to document p95 latency and error rate.
How the script works
The script scripts/load-test-infer.js is a k6 load test (not Node.js or Bun). It:
- Engine: Uses k6 (Grafana k6). Install with:
brew install k6(macOS) or see k6 installation. - Target: Sends
POST /api/intent/inferwith a fixed JSON body:{ "events": [ { "actor": "user", "action": "login" }, { "actor": "user", "action": "submit" } ] }. - Load: 50 virtual users (VUs), 30 seconds, ~0.1 s sleep between iterations.
- Thresholds: Fails the run if error rate ≥ 5% or p95 latency ≥ 2 s.
- Base URL: From env
K6_BASE_URLor defaulthttp://localhost:5000.
So you must have Sample.Blazor running and k6 installed before running the script.
How to run
- Install k6 (if needed):
brew install k6. - Start Sample.Blazor:
dotnet run --project samples/Intentum.Sample.Blazor/Intentum.Sample.Blazor.csproj(default: http://localhost:5018). - From repo root run k6:
k6 run scripts/load-test-infer.js. - Optional: override base URL:
K6_BASE_URL=http://localhost:5001 k6 run scripts/load-test-infer.js.
Result summary (example)
| Metric | Target | Example (run locally) |
|---|---|---|
| p95 latency | < 2s | ~XX ms |
| Error rate | < 5% | ~0% |
| RPS | — | ~XX |
(Fill in after running k6 run scripts/load-test-infer.js; k6 prints summary to stdout.)
Use these numbers for production readiness and capacity planning.