README.md34 lines · main
1# load tests
2
3synthetic load harnesses for the briven control + data planes. each script is a single-file bun program — no external deps, no compose, no ci wiring required to run them locally.
4
5## available
6
7### `realtime-subs.ts`
8
9opens N concurrent websocket subscriptions against `apps/realtime`, reports first-frame latency p50/p99 + max + failure counts.
10
11phase 2 target: **1,000 concurrent subs on KVM4 with p99 first-frame latency under 500ms and zero connection failures**.
12
13```bash
14# point at a running realtime service + project
15export BRIVEN_RUNTIME_SHARED_SECRET=...
16bun run infra/load-tests/realtime-subs.ts \
17 --url ws://localhost:3004/v1/subscribe \
18 --project p_01HZ... \
19 --function poolStats \
20 --subs 1000 \
21 --duration 60
22```
23
24stdout reports a json summary on completion. exit code is non-zero if any connection failed — usable in ci.
25
26**caveat:** the harness conveys the runtime shared secret via `?bearer=…` in the ws url because the browser-style `WebSocket` constructor doesn't accept headers. the realtime service treats this as a load-test-only auth path; the production sdk sends a real `Authorization` header during the upgrade.
27
28## what to add next
29
30- **deploy-flood.ts** — POST `/v1/projects/:id/deployments` at the tier rate-limit ceiling to validate `RATE_LIMITS_BY_TIER.deploy` works as advertised
31- **invoke-flood.ts** — same, against `/v1/projects/:id/functions/:name`
32- **schema-stress.ts** — generate a 100-table schema, time end-to-end deploy + apply
33
34these are tracked under TODO §Phase 2 §C "operations & infra".
Preview

load tests

synthetic load harnesses for the briven control + data planes. each script is a single-file bun program — no external deps, no compose, no ci wiring required to run them locally.

available

realtime-subs.ts

opens N concurrent websocket subscriptions against apps/realtime, reports first-frame latency p50/p99 + max + failure counts.

phase 2 target: 1,000 concurrent subs on KVM4 with p99 first-frame latency under 500ms and zero connection failures.

# point at a running realtime service + project
export BRIVEN_RUNTIME_SHARED_SECRET=...
bun run infra/load-tests/realtime-subs.ts \
  --url ws://localhost:3004/v1/subscribe \
  --project p_01HZ... \
  --function poolStats \
  --subs 1000 \
  --duration 60

stdout reports a json summary on completion. exit code is non-zero if any connection failed — usable in ci.

caveat: the harness conveys the runtime shared secret via ?bearer=… in the ws url because the browser-style WebSocket constructor doesn't accept headers. the realtime service treats this as a load-test-only auth path; the production sdk sends a real Authorization header during the upgrade.

what to add next

  • deploy-flood.ts — POST /v1/projects/:id/deployments at the tier rate-limit ceiling to validate RATE_LIMITS_BY_TIER.deploy works as advertised
  • invoke-flood.ts — same, against /v1/projects/:id/functions/:name
  • schema-stress.ts — generate a 100-table schema, time end-to-end deploy + apply

these are tracked under TODO §Phase 2 §C "operations & infra".