# Runbook: load testing with Locust Proves the vault holds its latency and memory budgets under concurrency, and finds the exact point where it sheds load. Run before every release, after any crypt or streaming change, and monthly on the ops calendar. ## Setup Tools: the repo `.venv` (auto-created), curl, jq, python3. No hand-installed Locust: `tests/load-run.sh` creates `.venv` and installs `tests/load/requirements.txt` (locust 2.47.0) on first use. Everything targets a scratch server on 127.0.0.1:18771 in a temp dir; production data is never touched. ## Commands ```text make load-smoke # 10 users, 60s, 10MB fetch blob make load-soak # 64 users, 10min, 1MB fetch blob LOAD_USERS=80 LOAD_TIME=90s ./tests/load-run.sh soak # 503 probe ``` The runner boots the server, bootstraps, creates one grant, seeds a fetch blob plus `/dav/load.bin`, exports creds as env vars, runs locust headless with CSV stats, samples server RSS every 5s, counts `aead-fail` plus `integrity-fail` audit lines, then wipes the scratch dir. ## Flows under test | Task | Weight | Request | Pass rule | |---|---|---|---| | store 1MB | 1 | POST /store, Basic store creds | 200 with id, or 429 (rate cap) | | fetch blob | 3 | GET /fetch/ID, Basic grant creds | 200 with exact byte length | | DAV GET | 1 | GET /dav/load.bin, Basic grant creds | 200 with exact byte length | Users wait 0.1-1.0s between tasks. Auth uses a precomputed Basic header; any credential or crypto breakage shows up as failures, never as skewed timings. ## How to read the output - Stats table: per-endpoint requests, failures, avg/min/max/ median ms, requests/s. Percentile table below it (50th to 100th). CSV copies land next to the scratch dir log. - Store shows a bimodal shape by design: 200s take ~90ms (KDF), 429s take ~2ms (rate cap at 20 per 300s per peer). Both count as pass; anything else fails. - 503 `busy` (4-byte body) past 64 concurrent connections is the conn cap shedding load. Expected in probe runs, a surprise anywhere else. - RSS line: min/max/avg server KB across 5s samples. Must stay flat within a run; growth across runs is a leak until proven otherwise. - Audit markers must stay zero on every run: any `aead-fail` or `integrity-fail` line means the load exposed real corruption or tampering, not a capacity limit. ## Latest results (2026-10-31, this machine) Smoke, 10 users, 60s, 10MB fetch: 788 requests, 0 failures. | Endpoint | reqs | avg | p50 | p95 | p99 | req/s | |---|---|---|---|---|---|---| | fetch 10MB | 485 | 229 | 220 | 370 | 440 | 8.11 | | DAV GET 1MB | 162 | 174 | 160 | 310 | 360 | 2.71 | | store 1MB | 141 | 34 | 2 | 230 | 360 | 2.36 | RSS min 8176KB, max 92224KB, avg 67400KB. Markers zero. Soak, 64 users, 600s, 1MB fetch: 10096 requests, 0 failures. | Endpoint | reqs | avg | p50 | p95 | p99 | req/s | |---|---|---|---|---|---|---| | fetch 1MB | 6070 | 3997 | 4000 | 4300 | 4500 | 10.12 | | DAV GET 1MB | 1973 | 4014 | 4000 | 4300 | 4500 | 3.29 | | store 1MB | 2053 | 11 | 2 | 25 | 36 | 3.42 | RSS min 7112KB, max 259564KB, avg 235276KB. Markers zero. Latency is KDF-queue-bound (one Argon2id at a time by design); correct throughout, slow at this concurrency. This was the pre-cache baseline; see the M9 re-run below. Soak re-run with key cache, 64 users, 600s, 1MB fetch: 68130 requests, 0 failures. | Endpoint | reqs | avg | p50 | p95 | p99 | req/s | |---|---|---|---|---|---|---| | fetch 1MB | 40702 | 6 | 6 | 8 | 10 | 67.85 | | DAV GET 1MB | 13748 | 6 | 6 | 8 | 10 | 22.92 | | store 1MB | 13680 | 2 | 2 | 3 | 5 | 22.81 | RSS min 7180KB, max 41924KB, avg 31458KB. Markers zero. Median 4000ms to 6ms, throughput 10 to 68 fetch req/s. Probe, 80 users, 90s: 2462 requests, 930 failures (37.77%), every failure a clean `503 busy` on fetch, DAV, and store. Markers zero, RSS max 273052KB. The cap sheds load without touching crypto. ## Operating envelope (measured) - Single-digit concurrency: sub-500ms fetches. - 10 users at 10MB: p95 370ms, NFR-04 holds with 5x headroom. - 64 users with key cache: median 6ms, p95 8ms at 1MB, zero errors, memory flat at ~31MB avg. - Past 64 concurrent connections: 503 shed, zero errors. ## Troubleshooting - `boot failed`: port 18771 busy or binary stale; `make build` then retry. - `grant failed`: bootstrap creds misread; check `.env.json` in a manual scratch boot. - All 403s: exported creds empty; the runner aborts on null, so this means a hand-run env mistake. - Unexpected 500s: stop, keep the scratch dir, read `tosv_audit.log` for `aead-fail` versus `integrity-fail`, file as a crypto finding, not a capacity note. - Locust missing or old: delete `.venv` and rerun; the runner reinstalls the pinned version. ## See also - [Runbook index](README.md), [status](../status.md), [NFR rows](../SPEC.md), [streaming](../sec-streaming.md), [memory](../sec-memory.md)